Skip to content

Commit

Permalink
fixup! Support parallel limit in execution loop (#210)
Browse files Browse the repository at this point in the history
  • Loading branch information
OndraM committed Nov 1, 2018
1 parent 1223694 commit 2df6ad9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
Expand Up @@ -8,7 +8,7 @@ Testcase "Lmc\Steward\Console\Command\Fixtures\ParallelTests\TestDependingOnFirs
[%s] Execution of testcase "Lmc\Steward\Console\Command\Fixtures\ParallelTests\FirstTest" started%A
%A
[%s] Finished execution of testcase "Lmc\Steward\Console\Command\Fixtures\ParallelTests\FirstTest" (result: passed, time: %f sec)
[%s] Dequeing testcase "Lmc\Steward\Console\Command\Fixtures\ParallelTests\SecondTest" from parallel limit
[%s] Dequeing testcase "Lmc\Steward\Console\Command\Fixtures\ParallelTests\SecondTest" which was queued because of parallel limit
%A
[%s] Finished execution of testcase "Lmc\Steward\Console\Command\Fixtures\ParallelTests\SecondTest" (result: passed, time: %f sec)
[%s] Dequeing testcase "Lmc\Steward\Console\Command\Fixtures\ParallelTests\TestDependingOnFirstTest"
Expand Down
7 changes: 5 additions & 2 deletions src/Process/ExecutionLoop.php
Expand Up @@ -216,7 +216,8 @@ protected function dequeueDependentProcesses(): void
foreach ($queued as $testClass => $processWrapper) {
$delaySeconds = $processWrapper->getDelayMinutes() * 60;

if (!$this->parallelLimitReached() && in_array($processWrapper->getDelayAfter(), $doneClasses, true)
if (!$this->parallelLimitReached()
&& in_array($processWrapper->getDelayAfter(), $doneClasses, true)
&& (time() - $done[$processWrapper->getDelayAfter()]->getFinishedTime()) > $delaySeconds
) {
if ($this->io->isVeryVerbose()) {
Expand All @@ -234,7 +235,9 @@ protected function dequeueParallelProcesses(): void
foreach ($queued as $testClass => $processWrapper) {
if (!$processWrapper->isDelayed() && !$this->parallelLimitReached()) {
if ($this->io->isVeryVerbose()) {
$this->io->runStatus(sprintf('Dequeing testcase "%s" from parallel limit', $testClass));
$this->io->runStatus(
sprintf('Dequeing testcase "%s" which was queued because of parallel limit', $testClass)
);
}
$processWrapper->setStatus(ProcessWrapper::PROCESS_STATUS_PREPARED);
}
Expand Down

0 comments on commit 2df6ad9

Please sign in to comment.