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

Commit

Permalink
update idl
Browse files Browse the repository at this point in the history
Signed-off-by: Kevin Su <[email protected]>
  • Loading branch information
pingsutw committed May 9, 2023
1 parent e319c65 commit abaf51d
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 20 deletions.
4 changes: 1 addition & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ require (
github.com/cloudevents/sdk-go/v2 v2.8.0
github.com/coreos/go-oidc v2.2.1+incompatible
github.com/evanphx/json-patch v4.12.0+incompatible
github.com/flyteorg/flyteidl v1.3.19
github.com/flyteorg/flyteidl v1.5.3
github.com/flyteorg/flyteplugins v1.0.56
github.com/flyteorg/flytepropeller v1.1.87
github.com/flyteorg/flytestdlib v1.0.15
Expand Down Expand Up @@ -209,5 +209,3 @@ require (
)

replace github.com/robfig/cron/v3 => github.com/unionai/cron/v3 v3.0.2-0.20210825070134-bfc34418fe84

replace github.com/flyteorg/flyteidl => github.com/flyteorg/flyteidl v1.5.2-0.20230504203702-1f2dc1fbedb0
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -312,8 +312,8 @@ github.com/fatih/structs v1.0.0/go.mod h1:9NiDSp5zOcgEDl+j00MP/WkGVPOlPRLejGD8Ga
github.com/fatih/structs v1.1.0/go.mod h1:9NiDSp5zOcgEDl+j00MP/WkGVPOlPRLejGD8Ga6PJ7M=
github.com/felixge/httpsnoop v1.0.1 h1:lvB5Jl89CsZtGIWuTcDM1E/vkVs49/Ml7JJe07l8SPQ=
github.com/felixge/httpsnoop v1.0.1/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U=
github.com/flyteorg/flyteidl v1.5.2-0.20230504203702-1f2dc1fbedb0 h1:0jWt1RKWaNWh8DHyRLex+WaZaotn6zLjMCAjU8xkcn4=
github.com/flyteorg/flyteidl v1.5.2-0.20230504203702-1f2dc1fbedb0/go.mod h1:ckLjB51moX4L0oQml+WTCrPK50zrJf6IZJ6LPC0RB4I=
github.com/flyteorg/flyteidl v1.5.3 h1:qHyU9kvcxGIkXoloi768ayx9FHrs961dZC3WYziGGZA=
github.com/flyteorg/flyteidl v1.5.3/go.mod h1:ckLjB51moX4L0oQml+WTCrPK50zrJf6IZJ6LPC0RB4I=
github.com/flyteorg/flyteplugins v1.0.56 h1:kBTDgTpdSi7wcptk4cMwz5vfh1MU82VaUMMboe1InXw=
github.com/flyteorg/flyteplugins v1.0.56/go.mod h1:aFCKSn8TPzxSAILIiogHtUnHlUCN9+y6Vf+r9R4KZDU=
github.com/flyteorg/flytepropeller v1.1.87 h1:Px7ASDjrWyeVrUb15qXmhw9QK7xPcFjL5Yetr2P6iGM=
Expand Down
28 changes: 15 additions & 13 deletions pkg/manager/impl/execution_manager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1087,8 +1087,8 @@ func TestCreateExecutionWithEnvs(t *testing.T) {
tests := []struct {
name string
task bool
envs map[string]string
want map[string]string
envs []*core.KeyValuePair
want []*core.KeyValuePair
}{
{
name: "LaunchPlanDefault",
Expand All @@ -1099,8 +1099,8 @@ func TestCreateExecutionWithEnvs(t *testing.T) {
{
name: "LaunchPlanEnable",
task: false,
envs: map[string]string{"foo": "bar"},
want: map[string]string{"foo": "bar"},
envs: []*core.KeyValuePair{{Key: "foo", Value: "bar"}},
want: []*core.KeyValuePair{{Key: "foo", Value: "bar"}},
},
{
name: "TaskDefault",
Expand All @@ -1111,8 +1111,8 @@ func TestCreateExecutionWithEnvs(t *testing.T) {
{
name: "TaskEnable",
task: true,
envs: map[string]string{"foo": "bar"},
want: map[string]string{"foo": "bar"},
envs: []*core.KeyValuePair{{Key: "foo", Value: "bar"}},
want: []*core.KeyValuePair{{Key: "foo", Value: "bar"}},
},
}

Expand Down Expand Up @@ -1286,7 +1286,7 @@ func makeExecutionOverwriteCacheGetFunc(
}

func makeExecutionWithEnvs(
t *testing.T, closureBytes []byte, startTime *time.Time, envs map[string]string) repositoryMocks.GetExecutionFunc {
t *testing.T, closureBytes []byte, startTime *time.Time, envs []*core.KeyValuePair) repositoryMocks.GetExecutionFunc {
return func(ctx context.Context, input interfaces.Identifier) (models.Execution, error) {
assert.Equal(t, "project", input.Project)
assert.Equal(t, "domain", input.Domain)
Expand Down Expand Up @@ -1648,7 +1648,7 @@ func TestRelaunchExecutionEnvsOverride(t *testing.T) {
StartedAt: startTimeProto,
}
existingClosureBytes, _ := proto.Marshal(&existingClosure)
env := map[string]string{"foo": "bar"}
env := []*core.KeyValuePair{{Key: "foo", Value: "bar"}}
executionGetFunc := makeExecutionWithEnvs(t, existingClosureBytes, &startTime, env)
repository.ExecutionRepo().(*repositoryMocks.MockExecutionRepo).SetGetCallback(executionGetFunc)

Expand Down Expand Up @@ -2060,7 +2060,7 @@ func TestRecoverExecutionEnvsOverride(t *testing.T) {
StartedAt: startTimeProto,
}
existingClosureBytes, _ := proto.Marshal(&existingClosure)
env := map[string]string{"foo": "bar"}
env := []*core.KeyValuePair{{Key: "foo", Value: "bar"}}
executionGetFunc := makeExecutionWithEnvs(t, existingClosureBytes, &startTime, env)
repository.ExecutionRepo().(*repositoryMocks.MockExecutionRepo).SetGetCallback(executionGetFunc)

Expand Down Expand Up @@ -4432,7 +4432,7 @@ func TestGetExecutionConfigOverrides(t *testing.T) {
requestMaxParallelism := int32(10)
requestInterruptible := false
requestOverwriteCache := false
requestEnvironmentVariables := map[string]string{"hello": "world"}
requestEnvironmentVariables := []*core.KeyValuePair{{Key: "hello", Value: "world"}}

launchPlanLabels := map[string]string{"launchPlanLabelKey": "launchPlanLabelValue"}
launchPlanAnnotations := map[string]string{"launchPlanAnnotationKey": "launchPlanAnnotationValue"}
Expand All @@ -4442,7 +4442,7 @@ func TestGetExecutionConfigOverrides(t *testing.T) {
launchPlanMaxParallelism := int32(50)
launchPlanInterruptible := true
launchPlanOverwriteCache := true
launchPlanEnvironmentVariables := map[string]string{"foo": "bar"}
launchPlanEnvironmentVariables := []*core.KeyValuePair{{Key: "foo", Value: "bar"}}

applicationConfig := runtime.NewConfigurationProvider()

Expand Down Expand Up @@ -5030,7 +5030,7 @@ func TestGetExecutionConfigOverrides(t *testing.T) {
launchPlan := &admin.LaunchPlan{
Spec: &admin.LaunchPlanSpec{
Interruptible: &wrappers.BoolValue{Value: true},
Envs: &admin.Envs{Values: map[string]string{"foo": "bar"}},
Envs: &admin.Envs{Values: []*core.KeyValuePair{{Key: "foo", Value: "bar"}}},
},
}

Expand All @@ -5042,7 +5042,9 @@ func TestGetExecutionConfigOverrides(t *testing.T) {
assert.Nil(t, execConfig.GetRawOutputDataConfig())
assert.Nil(t, execConfig.GetLabels())
assert.Nil(t, execConfig.GetAnnotations())
assert.Equal(t, "bar", execConfig.Envs.Values["foo"])
assert.Equal(t, 1, len(execConfig.Envs.Values))
assert.Equal(t, "foo", execConfig.Envs.Values[0].Key)
assert.Equal(t, "bar", execConfig.Envs.Values[0].Value)
})
t.Run("launch plan with no interruptible override specified", func(t *testing.T) {
request := &admin.ExecutionCreateRequest{
Expand Down
9 changes: 8 additions & 1 deletion pkg/runtime/interfaces/application_configuration.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,15 @@ func (a *ApplicationConfig) GetOverwriteCache() bool {
}

func (a *ApplicationConfig) GetEnvs() *admin.Envs {
var envs []*core.KeyValuePair
for k, v := range a.Envs {
envs = append(envs, &core.KeyValuePair{
Key: k,
Value: v,
})
}
return &admin.Envs{
Values: a.Envs,
Values: envs,
}
}

Expand Down
6 changes: 5 additions & 1 deletion pkg/workflowengine/impl/prepare_execution.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,12 @@ func addExecutionOverrides(taskPluginOverrides []*admin.PluginOverride,

executionConfig.OverwriteCache = workflowExecutionConfig.GetOverwriteCache()

envs := make(map[string]string)
if workflowExecutionConfig.GetEnvs() != nil {
executionConfig.EnvironmentVariables = workflowExecutionConfig.GetEnvs().Values
for _, v := range workflowExecutionConfig.GetEnvs().Values {
envs[v.Key] = v.Value
}
executionConfig.EnvironmentVariables = envs
}
}
if taskResources != nil {
Expand Down

0 comments on commit abaf51d

Please sign in to comment.