Skip to main content
function TaskInfo.current_phase
def TaskInfo.current_phase() -> typing.Any
The currently-active TaskPhase, or None if no phase is open (tasks that never called task_update(..., phase=...) see None). Returns a fresh snapshot per call — duration_ms is computed against now. Callers wanting a refreshed elapsed re-invoke the method. function TaskInfo.phase
def TaskInfo.phase(
name: str,
/,
description: str = ,
emoji: str = ,
display_name: str = 
) -> None
Mark a phase boundary. First call: synthesizes an “init” phase covering task spawn to now (so phase durations reconcile to total task time), then opens phase name. Subsequent call with a different name: closes the active phase (records its duration), opens a new one. Subsequent call with the same name (incl. the active phase): no-op. This makes it safe to pass phase= on bare data-refresh task_update() emits inside a streaming loop. emoji is an optional decoration string carried on the phase record. Surface renderers prefix it onto the phase label when non-empty (🔨 Build). Empty string when unset. display_name is an optional display-label override. When non-empty, renderers use it verbatim; when empty, they titlecase name. Use it when naive titlecasing reads oddly; regular underscore-separated identifiers (bazel_queryBazel query) don’t need it. Same-name no-op calls don’t update emoji or display_name on the already-open phase — set them on the call that opens the phase. function TaskInfo.phases
def TaskInfo.phases() -> typing.Any
Snapshot of closed phases as a list[TaskPhase]. The currently-active phase is NOT included — use current_phase() for that. Each TaskPhase is a snapshot (not a live view): duration_ms, interrupted, emoji, display_name, and description are captured at the moment phases() is called. Called as a method rather than an attribute because the list is freshly allocated on each call (Starlark attributes don’t expose the heap). property TaskInfo.elapsed_ms
TaskInfo.elapsed_ms: int
Task wall time so far in milliseconds (now - task spawn). Refreshed on every read; surface renderers use this for the “Task time” item in the status surface header. property TaskInfo.friendly_kind
TaskInfo.friendly_kind: str
The human-readable display label for the task kind. Set via task(friendly_kind=...); defaults to a Title-Cased form of kind. property TaskInfo.friendly_name
TaskInfo.friendly_name: str
The human-readable label for this invocation. Set via --task:friendly-name; defaults to name verbatim. property TaskInfo.group
TaskInfo.group: list[str]
The group(s) this task belongs to. property TaskInfo.id
TaskInfo.id: str
A globally unique UUID v4 for this task invocation. Always auto-generated; use name for a short human-readable discriminator. property TaskInfo.kind
TaskInfo.kind: str
The kind of task — the command being run (e.g. build, test, lint). Derived from the snakeacase export variable (or the task(kind=...) kwarg). Use name for the unique identity of this particular invocation. property TaskInfo.name
TaskInfo.name: str
A short name uniquely identifying this task invocation. Set via --task:name on the CLI; defaults to <kind>-<suffix> so repeated invocations of the same kind in one pipeline stay distinct.