forked from flyteorg/flyte
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Modify array task behavior based on task type version (flyteorg#152)
- Loading branch information
Katrina Rogan
authored
Mar 9, 2021
1 parent
58b0327
commit eddc8a0
Showing
12 changed files
with
279 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package array | ||
|
||
import ( | ||
idlCore "github.com/flyteorg/flyteidl/gen/pb-go/flyteidl/core" | ||
"github.com/flyteorg/flyteplugins/go/tasks/pluginmachinery/core" | ||
"github.com/flyteorg/flyteplugins/go/tasks/pluginmachinery/io" | ||
"github.com/flyteorg/flytestdlib/storage" | ||
) | ||
|
||
// A proxy inputreader that overrides the inputpath to be the inputpathprefix for array jobs | ||
type arrayJobInputReader struct { | ||
io.InputReader | ||
} | ||
|
||
// We override the inputpath to return the prefix path for array jobs | ||
func (i arrayJobInputReader) GetInputPath() storage.DataReference { | ||
return i.GetInputPrefixPath() | ||
} | ||
|
||
func GetInputReader(tCtx core.TaskExecutionContext, taskTemplate *idlCore.TaskTemplate) io.InputReader { | ||
var inputReader io.InputReader | ||
if taskTemplate.GetTaskTypeVersion() == 0 { | ||
// Prior to task type version == 1, dynamic type tasks (including array tasks) would write input files for each | ||
// individual array task instance. In this case we use a modified input reader to only pass in the parent input | ||
// directory. | ||
inputReader = arrayJobInputReader{tCtx.InputReader()} | ||
} else { | ||
inputReader = tCtx.InputReader() | ||
} | ||
return inputReader | ||
} |
Oops, something went wrong.