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