Skip to content

[V2] Pass run context to subaction + return in GetRunDetails#7094

Open
machichima wants to merge 3 commits intoflyteorg:v2from
machichima:run-context-to-subaction
Open

[V2] Pass run context to subaction + return in GetRunDetails#7094
machichima wants to merge 3 commits intoflyteorg:v2from
machichima:run-context-to-subaction

Conversation

@machichima
Copy link
Copy Markdown
Member

@machichima machichima commented Mar 26, 2026

Tracking issue

Why are the changes needed?

  • Subaction should also get the same run context from its parent.
  • To update the Env vars when re-run a task in UI, we need to return env vars through GetRunDetails

What changes were proposed in this pull request?

  • Pass run context down to child actions
  • Return RunSpec in GetRunDetails API

How was this patch tested?

  • Run sandbox and ensure 1) run context appears in subactions; 2) We can see env var in the re-run page

  • subaction TaskAction CR:

image
  • subaction pod: image

  • UI re-run page image

Labels

Please add one or more of the following labels to categorize your PR:

  • added: For new features.
  • changed: For changes in existing functionality.
  • deprecated: For soon-to-be-removed features.
  • removed: For features being removed.
  • fixed: For any bug fixed.
  • security: In case of vulnerabilities

This is important to improve the readability of release notes.

Setup process

Screenshots

Check all the applicable boxes

  • I updated the documentation accordingly.
  • All new and existing tests passed.
  • All commits are signed-off.

Related PRs

Docs link

  • main

Signed-off-by: machichima <nary12321@gmail.com>
Signed-off-by: machichima <nary12321@gmail.com>
@github-actions github-actions bot mentioned this pull request Mar 26, 2026
3 tasks
if taskAction == nil || parentTaskAction == nil {
return
}
taskAction.Spec.EnvVars = cloneStringMap(parentTaskAction.Spec.EnvVars)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we append parent action's ENVVAR into child action's ENVVAR instead of overwrite? Child action probably has it's own ENVVAR

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the current implementation, TaskAction.Spec.EnvVars is treated as run-scoped context projected from RunSpec, not per-subaction overrides.

In flyte-sdk, when enqueue a subaction, we do not pass any RunSpec that can override parent action's context setting

https://github.com/flyteorg/flyte-sdk/blob/ef9eda5b55102c850b82e14deb530d7a95dae6c1/src/flyte/_internal/controllers/remote/_core.py#L381-L392


if len(action.RunSpec) > 0 {
spec := &task.RunSpec{}
if err := proto.Unmarshal(action.RunSpec, spec); err == nil {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Curious why do we not handling the unmarshal error? Don't we need to log it or return it?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I think we should log here. Added in 75290ff

Signed-off-by: machichima <nary12321@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants