Skip to content

Commit

Permalink
[SYSINFRA-1419] reflow/flow: Avoid creating copy of Fileset
Browse files Browse the repository at this point in the history
Summary: Use a pointer instead of value to avoid creating a copy of the resolved fileset.

Test Plan: Unit and Integration tests.

Reviewers: pboyapalli

Reviewed By: pboyapalli

Subscribers: dnicolaou

Differential Revision: https://phabricator.grailbio.com/D72110

fbshipit-source-id: 43f83e8
  • Loading branch information
swami-m authored and Ubuntu committed Apr 8, 2022
1 parent 009431e commit 2ba16d3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions flow/eval.go
Original file line number Diff line number Diff line change
Expand Up @@ -1714,7 +1714,7 @@ var statusPrinters = [maxOp]struct {
fmt.Fprintf(w, " %s = \n", arg)
var fs reflow.Fileset
if len(f.resolvedFs) > earg.Index {
fs = f.resolvedFs[earg.Index]
fs = *f.resolvedFs[earg.Index]
}
if !fs.Empty() {
printFileset(w, " ", fs)
Expand Down Expand Up @@ -1921,13 +1921,13 @@ func (e *Eval) taskWait(ctx context.Context, f *Flow, task *sched.Task) error {
// If this is an Exec and f.Argmap is defined, then
// update the flow's resolved filesets.
n := f.NExecArg()
f.resolvedFs = make([]reflow.Fileset, n)
f.resolvedFs = make([]*reflow.Fileset, n)
for i := 0; i < n; i++ {
earg, arg := f.ExecArg(i), task.Config.Args[i]
if earg.Out {
continue
}
f.resolvedFs[earg.Index] = *arg.Fileset
f.resolvedFs[earg.Index] = arg.Fileset
}
}
e.LogFlow(ctx, f)
Expand Down
2 changes: 1 addition & 1 deletion flow/flow.go
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ type Flow struct {
// ArgMap maps exec arguments to dependencies. (OpExec).
Argmap []ExecArg
// resolvedFs maps exec arguments to resolved filesets. (OpExec).
resolvedFs []reflow.Fileset
resolvedFs []*reflow.Fileset
// OutputIsDir tells whether the output i is a directory.
OutputIsDir []bool

Expand Down

0 comments on commit 2ba16d3

Please sign in to comment.