Skip to content

docs(interruptible-tasks-and-queues): add on-demand fallback example - #1680

Merged
ppiegaze merged 3 commits into
mainfrom
docs/spot-ondemand-fallback
Oct 5, 2026
Merged

ppiegaze merged 3 commits into
mainfrom
docs/spot-ondemand-fallback

Conversation

@LeonKolyang

Copy link
Copy Markdown
Contributor

Adds a "Behavior if spot instances are not available" section to the interruptible
tasks page.

The page covered what happens when a spot instance is reclaimed, but not what
happens when the spot pool has no capacity to begin with — the task sits in
Queued / Waiting for resources indefinitely. The new section shows bounding that
wait with max_queued_time and catching MaxQueuedTimeExceededError to re-run
the task on on-demand compute via override(interruptible=False), and links to
the equivalent GPU-capacity pattern in the error-handling guide.

The example uses async def rather than the def in the surrounding snippets:
calling a sync task from inside an async task raises
SyncTaskCallInAsyncContextError.

Verified against a live cluster (flyte 2.10.8.dev2): the spot action ends
TIMED_OUT with code QUEUED_TIMEOUT_EXCEEDED and the on-demand retry succeeds.

Copilot AI balanced review requested due to automatic review settings October 5, 2026 11:33

Copilot AI left a comment

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.

Copilot review overview

🟡 Changes recommended

The caller also runs on spot compute, preventing the fallback from executing when spot capacity is unavailable.

Review effort: Balanced
Findings: 1 Medium severity

Open (1)
What changed in this PR

Adds guidance for falling back from unavailable spot capacity to on-demand compute.

Changes:

  • Documents spot-capacity queue behavior and max_queued_time.
  • Adds an asynchronous fallback example.
  • Links to the equivalent GPU-capacity pattern.
File Description
content/​user-guide/​tasks/​task-configuration/​interruptible-tasks-and-queues.md Adds spot-capacity fallback documentation and example.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

return {"accuracy": 0.95}


@env.task

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Fixed in a134d25 (merged from #1682). main now uses @env.task(interruptible=False), so it runs on-demand and can catch the child's MaxQueuedTimeExceededError. The page also explains why, and the on-demand retry now passes timeout=flyte.Timeout() so it doesn't inherit the 10-minute queue bound.

@github-actions

github-actions Bot commented Oct 5, 2026 •

Copy link
Copy Markdown

GHA build & deploy preview

Built by .github/workflows/build-pr.yml and deployed to the docs CF Pages project by .github/workflows/deploy-pr-preview.yml.

Branch alias https://pr-1680-docs-spot-ondemand-f.docs-dog.pages.dev
This commit https://3619cc66.docs-dog.pages.dev
Commit SHA a134d257469fe7cae53c58f9c352d49b791a759f

Updated automatically on every push.

Signed-off-by: LeonKolyang <leon.menkreo@googlemail.com>
Signed-off-by: LeonKolyang <leon.menkreo@googlemail.com>
@LeonKolyang
LeonKolyang force-pushed the docs/spot-ondemand-fallback branch from 4a4a990 to cfc0378 Compare October 5, 2026 11:47
…ound (#1682)

docs(interruptible-tasks): run the fallback parent on-demand, clear its queue bound

- The parent was in the interruptible environment, so with no spot
  capacity it could not start and never reached the fallback. It now
  runs with interruptible=False.
- override() keeps the task's timeout, so the on-demand retry inherited
  the 10-minute max_queued_time. Pass timeout=flyte.Timeout() to clear it
  (timeout=0 does not, since override uses `timeout or self.timeout`).
- Note that max_queued_time is per attempt, so retries multiply the wait
  before the fallback.
- Fix the existing invocation-time snippet: an async parent calling sync
  tasks without .aio() raises SyncTaskCallInAsyncContextError.
- Task-shaped heading, shorter sentences, "the parent", "can sit", and
  typed list inputs to avoid the pickle fallback.

Both snippets verified with a local run on flyte 2.10.7.

Signed-off-by: Peeter Piegaze <1153481+ppiegaze@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@ppiegaze
ppiegaze merged commit 5ca5f29 into main Oct 5, 2026
17 checks passed
@ppiegaze
ppiegaze deleted the docs/spot-ondemand-fallback branch October 5, 2026 18:11
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.

4 participants