-
Notifications
You must be signed in to change notification settings - Fork 63
Added execution config changes #378
Added execution config changes #378
Conversation
Labels: map[string]string{"defaultFlyteLabelKey": "defaultFlyteLabelValue"}, | ||
Annotations: map[string]string{"defaultFlyteAnnotationKey": "defaultFlyteAnnotationValue"}, | ||
OutputLocationPrefix: "defaultFlyteOutputLocationPrefix", | ||
K8SServiceAccount: "default", | ||
AssumableIamRole: "default", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are we ok with these defaults @katrogan
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm, besides setting the K8SServiceAccount
are the rest of these actually useful for a flyte execution? maybe we can omit the rest
Codecov Report
@@ Coverage Diff @@
## master #378 +/- ##
==========================================
+ Coverage 60.39% 60.62% +0.23%
==========================================
Files 150 150
Lines 10708 10739 +31
==========================================
+ Hits 6467 6511 +44
+ Misses 3543 3528 -15
- Partials 698 700 +2
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
// WorkflowExecutionConfigInterface is used as common interface for capturing the common behavior catering to the needs | ||
// of fetching the WorkflowExecutionConfig across LaunchPlanSpec, ExecutionCreateRequest | ||
// MatchableResource_WORKFLOW_EXECUTION_CONFIG and ApplicationConfig | ||
type WorkflowExecutionConfigInterface interface { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why does this need to be an interface?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It becomes very convenient now to use the same merge function
mergeIntoExecConfig(workflowExecConfig *admin.WorkflowExecutionConfig, spec WorkflowExecutionConfigInterface)
for launchplan spec, executionCreateRequest, matchable resorce and application config.
Without these we will have to define individual functions for each of these object types.
Abstracting this common functionality across all these make it easier to manage the code.
Let me know if you think otherwise
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see, maybe one day flyteorg/flyte#2242 will simplify this!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah that would help simplify a lot. I couldn't find a way to do this with current protobuf and faced the same issue with another service we wrote where we had to duplicate the message fields .
Labels: map[string]string{"defaultFlyteLabelKey": "defaultFlyteLabelValue"}, | ||
Annotations: map[string]string{"defaultFlyteAnnotationKey": "defaultFlyteAnnotationValue"}, | ||
OutputLocationPrefix: "defaultFlyteOutputLocationPrefix", | ||
K8SServiceAccount: "default", | ||
AssumableIamRole: "default", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm, besides setting the K8SServiceAccount
are the rest of these actually useful for a flyte execution? maybe we can omit the rest
Signed-off-by: Prafulla Mahindrakar <[email protected]>
Signed-off-by: Prafulla Mahindrakar <[email protected]>
Signed-off-by: Prafulla Mahindrakar <[email protected]>
Signed-off-by: Prafulla Mahindrakar <[email protected]>
4ad214e
to
c5ea342
Compare
Signed-off-by: Prafulla Mahindrakar <[email protected]>
Signed-off-by: Prafulla Mahindrakar <[email protected]>
Signed-off-by: Prafulla Mahindrakar <[email protected]>
Signed-off-by: Prafulla Mahindrakar <[email protected]>
Signed-off-by: Prafulla Mahindrakar <[email protected]>
@katrogan i have added default values only for k8ServiceAccount for now . Please have a look at the description along with the mentioned bug for workflow attribute |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mind updating the PR title before merging?
// WorkflowExecutionConfigInterface is used as common interface for capturing the common behavior catering to the needs | ||
// of fetching the WorkflowExecutionConfig across LaunchPlanSpec, ExecutionCreateRequest | ||
// MatchableResource_WORKFLOW_EXECUTION_CONFIG and ApplicationConfig | ||
type WorkflowExecutionConfigInterface interface { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see, maybe one day flyteorg/flyte#2242 will simplify this!
if workflowExecConfig.GetSecurityContext() == nil && spec.GetSecurityContext() != nil { | ||
workflowExecConfig.SecurityContext = spec.GetSecurityContext() | ||
} | ||
// Launchplan spec has label, annotation and rawOutputDataConfig initialized with empty values. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah, is this from flytekit serialization? thank you for documenting this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes that right
labels=entity.labels or _common_models.Labels({}),
annotations=entity.annotations or _common_models.Annotations({}),
auth_role=entity._auth_role or _common_models.AuthRole(),
raw_output_data_config=entity.raw_output_data_config or _common_models.RawOutputDataConfig(""),
|
||
workflowExecConfig := &admin.WorkflowExecutionConfig{} | ||
// merge the request spec into workflowExecConfig | ||
mergeIntoExecConfig(workflowExecConfig, request.Spec) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why this call instead of initializing the workflowExecConfig struct inline with value from the request.Spec?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Two reasons
- It allows us to not make changes in merge aswell getExecutionConfig whenever a new field is introduced.
- Since we now want old behavior where if any field is set in request spec then return that execution config immediately instead of checking for other overrides.
So i have kept the function with its return value checked. Let me know what you think
workflowExecConfig.Annotations = spec.GetAnnotations() | ||
} | ||
} | ||
|
||
// Produces execution-time attributes for workflow execution. | ||
// Defaults to overridable execution values set in the execution create request, then looks at the launch plan values | ||
// (if any) before defaulting to values set in the matchable resource db and further if matchable resources don't | ||
// exist then defaults to one set in application configuration | ||
func (m *ExecutionManager) getExecutionConfig(ctx context.Context, request *admin.ExecutionCreateRequest, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what if a user specifies some fields in the execution config in the request spec, but not all?
I think we should then treat that execution config as finalized, and the omitted fields as intentionally excluded.
currently, we keep proceeding with the fallbacks regardless of whether the request spec is populated, or barring that, if the launch plan is then populated. i'm not sure this is right, what do you think? if one of these levels has any non-empty values then should we treat that execution config as the final execution config we apply?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wanted this to look like how we do override for go variables and scopes actually define what that level defines the value for that variable
https://go.dev/play/p/jdkv14fHY8N
But we don't have a way to tell protobuf fields that they are set but those are explicitly being set to nil or empty.
i have seen where some libraries provide a behavior of tristate
i.e set (having value/ having no value) / unset(uninitialized)
Something like this tristateBoolean having isUndef https://docs.oracle.com/cd/E26098_01/apirefs.1112/e17493/oracle/ide/util/TriStateBoolean.html#isUndef__
That way it easier to distinguish what the user wanted to do.
Also I think in the current state that issue comes even for maxParallelism = 0 in execution create request and launch plan spec having the same value and it will fall back to other overrides though the user intended to set maxParallelism = 0 in execution create Request
Having a tristate behavior solves such cases and make it easier to reason across overrides and avoid using custom logic IMO.
To keep logic similar to previous one , i am adding a isChanged bool flag in merge function which is checked after the merge from execution create request and launchplan spec and if it gets set then we return that config object.
Let me know what you think.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
re: the tri-state, we do something funky with one-ofs for notification overrides to permit a user to explicitly disable notifications as opposed to interpreting the optional field as omitted. we could consider updating the execution config in the proto definitions to have some kind of bool flag for "is set" so that even an empty execution config is considered explicitly set
isChanged looks good for now too!
|
||
// Optional: security context override to apply this execution. | ||
// iam_role references the fully qualified name of Identity & Access Management role to impersonate. | ||
AssumableIamRole string `json:"assumableIamRole"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: add comments to pflag?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We are not using this as pflag config and none of the other fields in this config can be passed from command line.
If we want that behavior then i would need to add a pflag generator and add pflag annotation to all.
Let me know if we need that now or in any future PR's
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah okay, nevermind then
…riding Signed-off-by: Prafulla Mahindrakar <[email protected]>
Signed-off-by: Prafulla Mahindrakar <[email protected]>
Signed-off-by: Prafulla Mahindrakar <[email protected]>
* Added execution config changes Signed-off-by: Prafulla Mahindrakar <[email protected]> * lint fixes Signed-off-by: Prafulla Mahindrakar <[email protected]> * using executionConfig data during launch Signed-off-by: Prafulla Mahindrakar <[email protected]> * resolve conflicts Signed-off-by: Prafulla Mahindrakar <[email protected]> * Removed defaults for labels and annotations Signed-off-by: Prafulla Mahindrakar <[email protected]> * added more coverage Signed-off-by: Prafulla Mahindrakar <[email protected]> * added more coverage Signed-off-by: Prafulla Mahindrakar <[email protected]> * Updating idl and lint fixes Signed-off-by: Prafulla Mahindrakar <[email protected]> * Adde missing go.sum Signed-off-by: Prafulla Mahindrakar <[email protected]> * feedback changes to return immediately if any field is set while overriding Signed-off-by: Prafulla Mahindrakar <[email protected]> * using released flyteidl Signed-off-by: Prafulla Mahindrakar <[email protected]> * using released flyteidl Signed-off-by: Prafulla Mahindrakar <[email protected]>
Signed-off-by: Prafulla Mahindrakar [email protected]
TL;DR
Testing Done
Using only the values.yaml changes
Launched pod
With overriden project domain attributes for WORKFLOW_EXECUTION_CONFIG
Worflow level attributes have a bug and hence couldn't be tested and also the current changes don't use workflow level execution config.
Type
Are all requirements met?
Complete description
How did you fix the bug, make the feature etc. Link to any design docs etc
Tracking Issue
flyteorg/flyte#2070
Follow-up issue
NA