baml.spawn.TaskGroup
A logical group of green threads.
Reference version
Signature
class baml.spawn.TaskGroupA logical group of green threads.
These have three primary purposes:
- Task groups limit how many spawns referencing it run concurrently. Excess spawns queue
FIFO and start as earlier ones settle; the
spawnstill returns itsFutureimmediately, so queueing is invisible. - Shared cancellation: calling
cancelon a group cancels all tasks in the group. - Debugging: task groups have an optional name and provide logical grouping of tasks.
Source:<builtin>/baml/ns_spawn/spawn.bamlbytes 1683–3150
Fields
_handle
$rust_typeStatic methods
function
new
(limit: int, name: string | null = …) -> baml.spawn.TaskGroup throws neverInstance methods
function
active_count
(self) -> int throws neverfunction
cancel
(self, pending: bool | null = …, active: bool | null = …) -> int throws neverfunction
limit
(self) -> int throws neverfunction
name
(self) -> string | null throws neverfunction
queued_count
(self) -> int throws neverfunction
set_limit
(self, limit: int) -> void throws neverImplementations
baml.Concrete for T
Source:<builtin>/baml/core.bamlbytes 747–779