setDescription('Lists tasks');
}
protected function doExecute(InputInterface $input, OutputInterface $output)
{
$output->writeln("Querying the task manager...");
$errors = 0;
$probe = $this->container['task-manager.live-information'];
$rows = array_map(function (Task $task) use ($probe, &$errors) {
$info = $probe->getTask($task);
$error = $info['actual'] !== $task->getStatus();
if ($error) {
$errors ++;
}
return [
$task->getId(),
$task->getName(),
$task->getStatus() !== 'started' ? "".$task->getStatus() . "" : $task->getStatus(),
$error ? "".$info['actual']."" : $info['actual'],
$info['process-id'],
];
}, $this->container['manipulator.task']->getRepository()->findAll());
$this
->getHelperSet()->get('table')
->setHeaders(['Id', 'Name', 'Status (set)', 'Actual (probed)', 'Process Id'])
->setRows($rows)
->render($output);
return $errors;
}
}