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