Skip to content

Tasks cannot be nested within a trace!#636

Merged
kumare3 merged 6 commits intomainfrom
fix-task-calls-in-trace
Feb 9, 2026
Merged

Tasks cannot be nested within a trace!#636
kumare3 merged 6 commits intomainfrom
fix-task-calls-in-trace

Conversation

@samhita-alla
Copy link
Contributor

@samhita-alla samhita-alla commented Feb 9, 2026

task_context is preserved inside a trace but any task called from within a trace will run as plain python.

Signed-off-by: Samhita Alla <aallasamhita@gmail.com>
@kumare3
Copy link
Contributor

kumare3 commented Feb 9, 2026

we should block calling tasks from a trace

kumare3 and others added 3 commits February 9, 2026 13:33
Tests verify that @task calls (via __call__ and .aio()) raise
TraceDoesNotAllowNestedTasksError when invoked inside a trace context,
and that .forward() remains usable as the escape hatch.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Ketan Umare <kumare3@users.noreply.github.com>
@kumare3 kumare3 changed the title run tasks as plain python functions if called from within a trace Tasks cannot be nested within a trace! Feb 9, 2026
kumare3 and others added 2 commits February 9, 2026 14:00
Signed-off-by: Ketan Umare <kumare3@users.noreply.github.com>
Verifies that calling a @task inside a @flyte.trace raises a
RuntimeUserError with code "TraceDoesNotAllowNestedTasksError"
when run through the full local controller pipeline.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@kumare3 kumare3 merged commit 07dc8c7 into main Feb 9, 2026
17 checks passed
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.

3 participants