runTasks function
- List<
ParallelTasks> tasks, { - required bool parallelize,
- bool disableCache = false,
- bool force = false,
Calls runTask with each given task that must run.
At the end of each TaskPhase, the executed
tasks' RunCondition.postRun actions are also run, unless disableCache
is set to true
.
Returns the result of each executed task. If a task fails, execution stops and only the results thus far accumulated are returned.
If a task's RunCondition.postRun action fails, a MultipleExceptions
is thrown with all accumulated errors up to the end of the phase the task
belongs to, including from other task's actions and postRun
s.
Notice that MultipleExceptions is not thrown in case there are
task failures, but no post-run action failures.
Tasks within each ParallelTasks entry are always called "simultaneously",
then their Future results are awaited in order. If parallelize
is true,
then all tasks that return true for Task.isParallelizable will be run
within Isolates, achieving true parallelism.
This method does not throw any Exception, failures are returned as TaskResult instances with errors.
Implementation
Future<List<TaskResult>> runTasks(List<ParallelTasks> tasks,
{required bool parallelize,
bool disableCache = false,
bool force = false}) async {
if (logger.isLoggable(Level.FINE)) {
final execMode = parallelize
? 'in parallel where possible, using separate Isolates for parallelizable Tasks'
: 'on main Isolate as no parallelization was enabled';
logger.fine('Will execute tasks $execMode');
}
return await _run(tasks,
parallelize: parallelize, disableCache: disableCache, force: force);
}