Skip to content

Add inline (zero-worker) execution mode for single-threaded use#802

Open
boxerab wants to merge 1 commit into
taskflow:masterfrom
boxerab:grok-inline-executor
Open

Add inline (zero-worker) execution mode for single-threaded use#802
boxerab wants to merge 1 commit into
taskflow:masterfrom
boxerab:grok-inline-executor

Conversation

@boxerab

@boxerab boxerab commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

When an Executor is constructed with 0 workers it now runs task graphs synchronously on the calling thread instead of spawning a worker pool, so the process stays truly single-threaded (no worker/notifier threads).

_run_inline() executes a fully-built static graph in topological order, mirroring the scheduler's rules: a node runs once its strong (non-conditioner) predecessors are met; a condition node runs its int() work and activates only the selected successor.

This new mode handles Static, Module (composed_of, recursed), Condition and MultiCondition tasks.

this_worker_id() reports 0 in inline mode (the caller is the sole worker).

References: #797

When an Executor is constructed with 0 workers it now runs task graphs
synchronously on the calling thread instead of spawning a worker pool,
so the process stays truly single-threaded (no worker/notifier threads).

_run_inline() executes a fully-built static graph in topological order,
mirroring the scheduler's rules: a node runs once its strong
(non-conditioner) predecessors are met; a condition node runs its int()
work and activates only the selected successor. Handles Static, Module
(composed_of, recursed), Condition and MultiCondition tasks.
this_worker_id() reports 0 in inline mode (the caller is the sole
worker).
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.

1 participant