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

Commit

Permalink
added environment variables to ExecutionConfig and propagated to task…
Browse files Browse the repository at this point in the history
…ExecutionMetadata

Signed-off-by: Daniel Rammer <[email protected]>
  • Loading branch information
hamersaw committed May 2, 2023
1 parent 0025cbe commit 2e17adc
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
2 changes: 2 additions & 0 deletions pkg/apis/flyteworkflow/v1alpha1/execution_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ type ExecutionConfig struct {
Interruptible *bool
// Defines whether a workflow should skip all its cached results and re-compute its output, overwriting any already stored data.
OverwriteCache bool
// Defines a map of environment varable name / value pairs that are applied to all tasks.
EnvironmentVariables map[string]string
}

type TaskPluginOverride struct {
Expand Down
14 changes: 10 additions & 4 deletions pkg/controller/nodes/task/taskexec_context.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,11 @@ func (te taskExecutionID) GetGeneratedNameWith(minLength, maxLength int) (string

type taskExecutionMetadata struct {
handler.NodeExecutionMetadata
taskExecID taskExecutionID
o pluginCore.TaskOverrides
maxAttempts uint32
platformResources *v1.ResourceRequirements
taskExecID taskExecutionID
o pluginCore.TaskOverrides
maxAttempts uint32
platformResources *v1.ResourceRequirements
environmentVariables map[string]string
}

func (t taskExecutionMetadata) GetTaskExecutionID() pluginCore.TaskExecutionID {
Expand All @@ -81,6 +82,10 @@ func (t taskExecutionMetadata) GetPlatformResources() *v1.ResourceRequirements {
return t.platformResources
}

func (t taskExecutionMetadata) GetEnvironmentVariables() map[string]string {
return t.environmentVariables
}

type taskExecutionContext struct {
handler.NodeExecutionContext
tm taskExecutionMetadata
Expand Down Expand Up @@ -289,6 +294,7 @@ func (t *Handler) newTaskExecutionContext(ctx context.Context, nCtx handler.Node
o: nCtx.Node(),
maxAttempts: maxAttempts,
platformResources: convertTaskResourcesToRequirements(nCtx.ExecutionContext().GetExecutionConfig().TaskResources),
environmentVariables: nCtx.ExecutionContext().GetExecutionConfig().EnvironmentVariables,
},
rm: resourcemanager.GetTaskResourceManager(
t.resourceManager, resourceNamespacePrefix, id),
Expand Down

0 comments on commit 2e17adc

Please sign in to comment.