RunTracker
ConsoleMonster.Live
The state of a run of many items (ConsoleRun, Invoke-ConsoleRun), safe to update from any thread: each item is pending, running or finished with an outcome; failures keep their message. RunView draws it.
Inheritance
- object
- RunTracker
Usage
Explore 5 API references to this type
This type appears in these public API surfaces even when no hand-authored example is attached directly to the page.
Returned or exposed by 1
- Property RunMonitor.Tracker
Accepted by parameters 4
- Constructor RunBoard.RunBoard
- Constructor RunDashboard.RunDashboard
- Constructor RunSummary.RunSummary
- Constructor RunView.RunView
Constructors
public RunTracker(int total, Func<TimeSpan>? clock = null) #Creates a tracker.
Parameters
- total int
- The number of items.
- clock System.Func<System.TimeSpan>? = null
- The run clock, or null for a stopwatch started now.
public RunTracker(IEnumerable<RunItem> items, Func<TimeSpan>? clock = null) #Creates a tracker with a fixed declaration of names, targets and categories for queued work.
Parameters
- items System.Collections.Generic.IEnumerable<ConsoleMonster.Live.RunItem>
- Items in input order; their position is the update key.
- clock System.Func<System.TimeSpan>? = null
- Optional monotonic clock, used by deterministic captures and embedded hosts.
Methods
public int Add() #Adds a pending item to a count-based run whose work is discovered incrementally.
Returns
int The new item's zero-based index.Exceptions
InvalidOperationException– The run has already finished or has a fixed declaration of named items.
public void Complete() #The run ended: items never started count as skipped and the clock stops.
public void Finished(int index, StatusKind outcome, string label, string? message = null, bool timedOut = false) #An item finished.
Parameters
- index int
- The item's position (0-based).
- outcome ConsoleMonster.Styling.StatusKind
- Pass, Fail, Warn, Skip, Error, Investigate or NotRun.
- label string
- Its label (for the failures list).
- message string? = null
- The error message of a failed item, or null.
- timedOut bool = false
- Whether it ran out of time.
public RunItemSnapshot? FinishItem(int index, StatusKind outcome, string? message = null, TimeSpan? duration = null, bool timedOut = false) #Completes a declared item exactly once, retaining its message and duration.
Parameters
- index int
- Zero-based input position.
- outcome ConsoleMonster.Styling.StatusKind
- Pass, Fail, Warn, Skip, Error, Investigate or NotRun.
- message string? = null
- Full literal completion message.
- duration System.TimeSpan? = null
- Explicit duration, or null to use the running clock.
- timedOut bool = false
- Whether the item's failure was a timeout.
public void Retrying(int index, string label, int attempt) #A running item failed and starts another attempt; it stays running and counts as retried.
Parameters
- index int
- The item's position (0-based).
- label string
- Its label.
- attempt int
- The attempt about to start (2 for the first retry).
public RunSnapshot Snapshot() #A consistent copy of the state, for drawing on another thread.
public void Started(int index, string label) #An item started.
Parameters
- index int
- The item's position (0-based).
- label string
- Its label.
public bool StartItem(int index, string? phase = null) #Starts a declared item or updates its phase. Finished items cannot restart.
Parameters
- index int
- Zero-based input position.
- phase string? = null
- Literal phase text.
Returns
bool False for an already finished item or completed run.