This commit is contained in:
parent
80df1dd33e
commit
5d306dac51
@ -244,24 +244,23 @@ class ParallelSuperVisor implements SuperVisor
|
||||
$this->taskStorage->modifyTask($task);
|
||||
fwrite(STDOUT, "Changed status of task '".$task->getId()."' to status " . Task::getStatusType($task->getStatus()) . PHP_EOL);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Check if all tasks are completed
|
||||
$allCompleted = true;
|
||||
$anyDelayed = false;
|
||||
$anyOther = false;
|
||||
foreach ($this->tasks as $task)
|
||||
{
|
||||
if ($task->getStatus() !== Task::COMPLETED && $task->getStatus() !== Task::CANCELLED)
|
||||
$allCompleted = false;
|
||||
if ($task->getStatus() === Task::DELAYED)
|
||||
$anyDelayed = true;
|
||||
elseif ($task->getStatus() !== Task::COMPLETED && $task->getStatus() !== Task::CANCELLED)
|
||||
$anyOther = true;
|
||||
}
|
||||
|
||||
// If all are finished and none are delayed
|
||||
if ($allCompleted && !$anyDelayed)
|
||||
if (!$anyOther && !$anyDelayed)
|
||||
return SuperVisor::FINISHED;
|
||||
elseif ($allCompleted && $anyDelayed)
|
||||
elseif (!$anyOther && $anyDelayed)
|
||||
return SuperVisor::CONSTRAINED;
|
||||
else
|
||||
return SuperVisor::RUNNING;
|
||||
|
Loading…
Reference in New Issue
Block a user