Class
ConsoleRun
ConsoleMonster.Live
Runs work over many items with a live view of the run (the C# side of Invoke-ConsoleRun).
Inheritance
- object
- ConsoleRun
Methods
ForEachAsync``2 2 overloads
public static Task<IReadOnlyList<RunResult<TItem?, TResult?>>> ForEachAsync<TItem, TResult>(IEnumerable<TItem?> items, Func<TItem?, CancellationToken, Task<TResult?>> body, Action<RunOptions> configure, CancellationToken cancellationToken = default) #Configures a fresh run request before executing the existing item-run pipeline.
Type Parameters
- TItem
- The item type.
- TResult
- The result type.
Parameters
- items System.Collections.Generic.IEnumerable<TItem?>
- The input items.
- body System.Func<TItem?, System.Threading.CancellationToken, System.Threading.Tasks.Task<TResult?>>
- The work.
- configure System.Action<ConsoleMonster.Live.RunOptions>
- Run settings.
- cancellationToken System.Threading.CancellationToken = default
- Cancellation.
public static async Task<IReadOnlyList<RunResult<TItem?, TResult?>>> ForEachAsync<TItem, TResult>(IEnumerable<TItem?> items, Func<TItem?, CancellationToken, Task<TResult?>> body, RunOptions? options = null, CancellationToken cancellationToken = default) #Runs body for every item, at most RunOptions.ThrottleLimit at a time, showing the run (summary line, item cells, running items, failures; one line per item when the output is not interactive). An item that throws, or runs past RunOptions.Timeout, counts as failed and the run goes on; cancelling stops starting new items, cancels the running ones and counts the rest as skipped.
Type Parameters
- TItem
- The item type.
- TResult
- The result type.
Parameters
- items System.Collections.Generic.IEnumerable<TItem?>
- The items.
- body System.Func<TItem?, System.Threading.CancellationToken, System.Threading.Tasks.Task<TResult?>>
- The work for one item; observe the token for timeouts and cancellation.
- options ConsoleMonster.Live.RunOptions? = null
- Options, or null for the defaults.
- cancellationToken System.Threading.CancellationToken = default
- Stops the run.
Returns
Task<IReadOnlyList<RunResult<TItem?, TResult?>>> One result per item, in input order (items never started are left out).