acoustic-carpenter-78188
03/24/2026, 12:27 PMwith_runcontext in flyte-sdk
What changes were proposed in this pull request?
• Add 2 fields in TaskAction CRD: EnvVars and Interruptible
• Store EnvVars, Labels, Annotations, Interruptible in CR and pass to pod created
• Also store context in input by write the whole input to protobuf
How was this patch tested?
Start sandbox and test with following flyte-sdk script
import flyte
env = flyte.TaskEnvironment("custom-context-example")
@env.task
async def leaf_task() -> str:
# Reads run-level context
print("leaf sees:", flyte.ctx().custom_context)
return flyte.ctx().custom_context.get("trace_id")
@env.task
async def root() -> str:
return await leaf_task()
if name == "__main__":
flyte.init_from_config()
# Base context for the entire run
run = flyte.with_runcontext(
custom_context={"trace_id": "root-abc", "experiment": "v1"},
env_vars={"foo": "boo"},
labels={"test_label": "test_value"},
annotations={"test_annotation": "test_annotation_value"}
).run(root)
print(run.url)
• TaskAction CR
image
• Pod:
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
flyteorg/flyteacoustic-carpenter-78188
03/24/2026, 4:57 PM