Skip to content

Commit

Permalink
deep copying arraynode tasktemplate interface (flyteorg#5479)
Browse files Browse the repository at this point in the history
Signed-off-by: Daniel Rammer <[email protected]>
  • Loading branch information
hamersaw authored and robert-ulbrich-mercedes-benz committed Jul 2, 2024
1 parent 80fbbba commit 6582d4c
Showing 1 changed file with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,14 @@ type arrayTaskReader struct {
}

func (a *arrayTaskReader) Read(ctx context.Context) (*core.TaskTemplate, error) {
taskTemplate, err := a.TaskReader.Read(ctx)
originalTaskTemplate, err := a.TaskReader.Read(ctx)
if err != nil {
return nil, err
}

// convert output list variable to singular
outputVariables := make(map[string]*core.Variable)
for key, value := range taskTemplate.Interface.Outputs.Variables {
for key, value := range originalTaskTemplate.Interface.Outputs.Variables {
switch v := value.Type.Type.(type) {
case *core.LiteralType_CollectionType:
outputVariables[key] = &core.Variable{
Expand All @@ -69,10 +69,14 @@ func (a *arrayTaskReader) Read(ctx context.Context) (*core.TaskTemplate, error)
}
}

taskTemplate.Interface.Outputs = &core.VariableMap{
Variables: outputVariables,
taskTemplate := *originalTaskTemplate
taskTemplate.Interface = &core.TypedInterface{
Inputs: originalTaskTemplate.Interface.Inputs,
Outputs: &core.VariableMap{
Variables: outputVariables,
},
}
return taskTemplate, nil
return &taskTemplate, nil
}

type arrayNodeExecutionContext struct {
Expand Down

0 comments on commit 6582d4c

Please sign in to comment.