Skip to content
This repository has been archived by the owner on Oct 9, 2023. It is now read-only.

Commit

Permalink
Merge c2e0080 into 109224c
Browse files Browse the repository at this point in the history
  • Loading branch information
pingsutw authored Jan 11, 2023
2 parents 109224c + c2e0080 commit ff6e9e9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
5 changes: 2 additions & 3 deletions go/tasks/plugins/array/awsbatch/transformer.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import (
const (
ArrayJobIndex = "BATCH_JOB_ARRAY_INDEX_VAR_NAME"
arrayJobIDFormatter = "%v:%v"
failOnError = "FLYTE_FAIL_ON_ERROR"
)

const assignResources = true
Expand Down Expand Up @@ -118,7 +119,6 @@ func UpdateBatchInputForArray(_ context.Context, batchInput *batch.SubmitJobInpu
envVars = append(envVars, &batch.KeyValuePair{Name: refStr(ArrayJobIndex), Value: refStr("FAKE_JOB_ARRAY_INDEX")},
&batch.KeyValuePair{Name: refStr("FAKE_JOB_ARRAY_INDEX"), Value: refStr("0")})
}

batchInput.ArrayProperties = arrayProps
batchInput.ContainerOverrides.Environment = envVars

Expand All @@ -136,15 +136,14 @@ func getEnvVarsForTask(ctx context.Context, execID pluginCore.TaskExecutionID, c
for key, value := range defaultEnvVars {
m[key] = value
}

m[failOnError] = "true"
finalEnvVars := make([]v1.EnvVar, 0, len(m))
for key, val := range m {
finalEnvVars = append(finalEnvVars, v1.EnvVar{
Name: key,
Value: val,
})
}

return finalEnvVars
}

Expand Down
5 changes: 5 additions & 0 deletions go/tasks/plugins/array/awsbatch/transformer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ func TestArrayJobToBatchInput(t *testing.T) {
ContainerOverrides: &batch.ContainerOverrides{
Command: []*string{ref("cmd"), ref("/inputs/prefix")},
Environment: []*batch.KeyValuePair{
{Name: ref(failOnError), Value: refStr("true")},
{Name: refStr("BATCH_JOB_ARRAY_INDEX_VAR_NAME"), Value: refStr("AWS_BATCH_JOB_ARRAY_INDEX")},
},
Memory: refInt(1074),
Expand Down Expand Up @@ -237,5 +238,9 @@ func Test_getEnvVarsForTask(t *testing.T) {
Name: "MyKey",
Value: "MyVal",
},
{
Name: "FLYTE_FAIL_ON_ERROR",
Value: "true",
},
}, envVars)
}

0 comments on commit ff6e9e9

Please sign in to comment.