Skip to content

Commit

Permalink
mocking plugin state reader in maptask (flyteorg#338)
Browse files Browse the repository at this point in the history
Signed-off-by: Daniel Rammer <[email protected]>
  • Loading branch information
hamersaw authored Mar 31, 2023
1 parent 61a90d4 commit eb522f4
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions flyteplugins/go/tasks/plugins/array/k8s/subtask_exec_context.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,23 @@ func (s SubTaskExecutionContext) TaskReader() pluginsCore.TaskReader {
return s.subtaskReader
}

// pluginStateReader overrides the default PluginStateReader because the maptask does not persist
// state between task evaluations.
type pluginStateReader struct{}

func (p pluginStateReader) GetStateVersion() uint8 {
return 0
}

func (p pluginStateReader) Get(t interface{}) (stateVersion uint8, err error) {
return 0, nil
}

// PluginStateReader overrides the default behavior to return a custom pluginStateReader.
func (s SubTaskExecutionContext) PluginStateReader() pluginsCore.PluginStateReader {
return pluginStateReader{}
}

// NewSubtaskExecutionContext constructs a SubTaskExecutionContext using the provided parameters
func NewSubTaskExecutionContext(ctx context.Context, tCtx pluginsCore.TaskExecutionContext, taskTemplate *core.TaskTemplate,
executionIndex, originalIndex int, retryAttempt uint64, systemFailures uint64) (SubTaskExecutionContext, error) {
Expand Down

0 comments on commit eb522f4

Please sign in to comment.