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

Add interruptible override to workflow execution config #minor #410

Merged
merged 7 commits into from
May 3, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ 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.9.0+incompatible
github.com/flyteorg/flyteidl v1.0.0
github.com/flyteorg/flyteidl v1.1.0
github.com/flyteorg/flyteplugins v1.0.0
github.com/flyteorg/flytepropeller v1.0.0
github.com/flyteorg/flytepropeller v1.1.0
github.com/flyteorg/flytestdlib v1.0.0
github.com/flyteorg/stow v0.3.3
github.com/ghodss/yaml v1.0.0
Expand Down
7 changes: 4 additions & 3 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -365,12 +365,13 @@ github.com/fatih/structs v1.1.0/go.mod h1:9NiDSp5zOcgEDl+j00MP/WkGVPOlPRLejGD8Ga
github.com/fatih/structtag v1.2.0/go.mod h1:mBJUNpUnHmRKrKlQQlmCrh5PuhftFbNv8Ys4/aAZl94=
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.0.0 h1:02V/h8cN3TzI6H9kzB2XNKR4XsJDmsGGfDWxbfmRZGs=
github.com/flyteorg/flyteidl v1.0.0/go.mod h1:JW0z1ZaHS9zWvDAwSMIyGhsf+V4zrzBBgh5IuqzMFCM=
github.com/flyteorg/flyteidl v1.1.0 h1:f8tdMXOuorS/d+4Ut2QarfDbdCOriK0S+EnlQzrwz9E=
github.com/flyteorg/flyteidl v1.1.0/go.mod h1:JW0z1ZaHS9zWvDAwSMIyGhsf+V4zrzBBgh5IuqzMFCM=
github.com/flyteorg/flyteplugins v1.0.0 h1:77hUJjiIxBmQ9rd3+cXjSGnzOVAFrSzCd59aIaYFB/8=
github.com/flyteorg/flyteplugins v1.0.0/go.mod h1:4Cpn+9RfanIieTTh2XsuL6zPYXtsR5UDe8YaEmXONT4=
github.com/flyteorg/flytepropeller v1.0.0 h1:INabpERWpJnNQWX0nw1aKeipiLayHv82MtP9Dtg1S1A=
github.com/flyteorg/flytepropeller v1.0.0/go.mod h1:OuegUOqqmhtoMVVhsmGBpT1Am0eutzjcqJk7z4bL29E=
github.com/flyteorg/flytepropeller v1.1.0 h1:R4iVoznTtpa10VC+CqCi4Wal/Yc+cng3dOi7hCLpi+Y=
github.com/flyteorg/flytepropeller v1.1.0/go.mod h1:QkWYTYZ3lrCY5nXKrYkVwbaGB2IhfzDmIGAWeWzuoak=
github.com/flyteorg/flytestdlib v1.0.0 h1:gb99ignMsVcNTUmWzArtcIDdkRjyzQQVBkWNOQakiFg=
github.com/flyteorg/flytestdlib v1.0.0/go.mod h1:QSVN5wIM1lM9d60eAEbX7NwweQXW96t5x4jbyftn89c=
github.com/flyteorg/stow v0.3.3 h1:tzeNl8mSZFL3oJDi0ACZj6FAineQAF4qyEp6bXtIdQY=
Expand Down
14 changes: 14 additions & 0 deletions pkg/manager/impl/execution_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ import (
"github.com/benbjohnson/clock"
"github.com/flyteorg/flyteadmin/pkg/manager/impl/shared"
"github.com/golang/protobuf/proto"
"github.com/golang/protobuf/ptypes/wrappers"
)

const childContainerQueueKey = "child_queue"
Expand Down Expand Up @@ -447,6 +448,8 @@ type WorkflowExecutionConfigInterface interface {
GetAnnotations() *admin.Annotations
// GetLabels Custom labels to be applied to a triggered execution resource.
GetLabels() *admin.Labels
// GetInterruptible indicates a workflow should be flagged as interruptible for a single execution. If omitted, the workflow's default is used.
GetInterruptible() *wrappers.BoolValue
}

// Merge into workflowExecConfig from spec and return true if any value has been changed
Expand Down Expand Up @@ -483,6 +486,17 @@ func mergeIntoExecConfig(workflowExecConfig *admin.WorkflowExecutionConfig, spec
workflowExecConfig.Annotations = spec.GetAnnotations()
isChanged = true
}

// Override interruptible flag if workflow execution config does not have a value set or the spec sets a different
// value that defined as the workflow default. This allows for workflows to have their interruptible setting
// explicitly turned on and off for a single execution.
if (workflowExecConfig.GetInterruptible() == nil && spec.GetInterruptible() != nil) ||
(workflowExecConfig.GetInterruptible() != nil && spec.GetInterruptible() != nil &&
workflowExecConfig.GetInterruptible().GetValue() != spec.GetInterruptible().GetValue()) {
workflowExecConfig.Interruptible = spec.GetInterruptible()
isChanged = true
}

return isChanged
}

Expand Down
Loading