Repository navigation
Custom context: document flyte run --custom-context and --custom-context-from-env - #1943
Merged
Merged
Conversation
…ontext-from-env` Drafted by Docsy for case 2025. Signed-off-by: unionai-docsy-agent[bot] <336110417+unionai-docsy-agent[bot]@users.noreply.github.com>
GHA build & deploy previewBuilt by
Updated automatically on every push. |
unionai-docsy-agent
Bot
requested review from
EngHabu,
cosmicbboy,
kumare3 and
samhita-alla
as code owners
November 9, 2026 13:51
Contributor
Author
|
Docsy actions: what Docsy did on this PR, and at whose direction. Docsy adds a line for each.
|
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are reported for the Flyte CLI run-level context documentation update.
No open issues 🎉
What changed in this PR
Updates the Custom context guide to explain how to set run-level context directly from the Flyte CLI, complementing the existing Python examples.
Changes:
- Documents both repeatable flags, their formats, and the minimum version requirement.
- Adds a CLI example and explains precedence, missing environment variables, and reserved-key validation.
- Describes integration with
with_runcontextand warns against storing secrets.
| File | Description |
|---|---|
content/user-guide/tasks/task-programming/custom-context.md |
Adds CLI instructions and links them from the run-level context overview. |
Review effort: Balanced
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed in the product
flyteorg/flyte-sdk#1713 was opened and merged on 2026-10-26 (signals 2025 and 2026). It adds two repeatable options to
flyte run:--custom-context KEY=VALUE--custom-context-from-env VARorKEY=VARWith these flags you can set a run's custom context without a Python launcher. The change first shipped in flyte-sdk
v2.12.2and is in every later release. The October release notes already list the flags, but the Custom context guide covered onlywith_runcontextandflyte.custom_context.Changes
content/user-guide/tasks/task-programming/custom-context.mdflyte runflags.flyte2.12.2 or later--local/--tuiruns anddeployed-task, the flags pass the merged values towith_runcontext(custom_context=...)--custom-contextwins when both flags set the same keyEvidence
The source is
RunArgumentsinsrc/flyte/cli/_run.pyin flyteorg/flyte-sdk atmain(9ff526b6). I also ranflyte run --local ... ctx_task.py mainwithflyte==2.12.4. In that script, a child task returnsflyte.get_custom_context(). Results:--custom-context experiment=calibration --custom-context-from-env API_BASE_URL(env set){'API_BASE_URL': 'https://x', 'experiment': 'calibration'}--custom-context-from-env base=API_BASE_URL{'base': 'https://x'}(theKEY=VARform renames the key)--custom-context k=fromflag --custom-context-from-env k=MYVAR{'k': 'fromflag'}(--custom-contextwins)--custom-context q=a=b{'q': 'a=b'}(the value is everything after the first=)--custom-context-from-env UNSET_VAR_XYZenvironment variable 'UNSET_VAR_XYZ' is not set.--custom-context _u_kickoff_time_input_arg=xCustom context key(s) ['_u_kickoff_time_input_arg'] are reserved by Flyte.Other statements and their sources:
with_runcontext(custom_context=...)for file tasks,--local/--tuianddeployed-task:_run.pycallsparsed_custom_context()in three places, one for each of these run types. For remote runs,_run_remoteinsrc/flyte/_run.pypassescustom_context=self._custom_contextintoconvert_from_native_to_inputs_binding_artifacts. It does this both for fetched tasks (LazyEntity/TaskDetails) and forTaskTemplate. I ran only the--localpath.--custom-context-from-envhelp text ("Custom context is stored as run metadata, so do not use it for secrets").Open questions
deployed-taskor a file task. Because of that, the page describes the CLI path by its mechanism (the samewith_runcontext(custom_context=...)call as Python) and does not claim end-to-end remote behavior. One remote launch would settle it:deployed-taskwith--custom-context, then check that the child task'sflyte.get_custom_context()has the key. The PR author (dansola) is not on the contact list, so no one is addressed here.Pre-flight review
Docsy's reviewer read this draft before it was opened and found 2 problems to fix. The draft was amended for them, and a check of the amendment found nothing left to fix.
Its optional suggestions, which the page doesn't need to be right; take them or not:
content/user-guide/tasks/task-programming/custom-context.mdline 98: The page uses two terms for the same storage. The Overview says custom context "is stored in the blob store of your Union/Flyte instance together with the task's inputs", and this line says "run metadata". The style guide asks for one term per concept. Reusing the Overview's description also makes the warning concrete: anyone who can read the run's inputs can read the value.Docsy case 2025: https://docsy.apps.demo.hosted.unionai.cloud/cases/2025
Drafted by Docsy, Union.ai's documentation agent, from the product changes and requests in this case. Review it like any PR; close it if it's not wanted.