-
Couldn't load subscription status.
- Fork 303
Add $stopAllOnAnyFailure flag to \Robo\Task\Base\ParallelExec #882
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: 2.x
Are you sure you want to change the base?
Conversation
| foreach ($running as $otherRunningProcess) { | ||
| $otherRunningProcess->stop(); | ||
| } | ||
| $queue = []; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't touch $running array because it feel safer to me to let it handle by the main while cycle.
| unset($running[$k]); | ||
| if ($this->stopOnFail && $process->getExitCode() !== 0) { | ||
| foreach ($running as $otherRunningProcess) { | ||
| $otherRunningProcess->stop(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can't be done without prefixing everything with exec command, read:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm, I am ambivalent about this. Would it be possible to use posix_setpgid as described in the PHP bug report to fix things for those who have the posix commands?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll try
3d72b7d to
37fbdc7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 on the functionality provided here; however, this does not operate the same way that "stopOnFail" does elsewhere in Robo (which is good; I don't really like stopOnFail).
Could we therefore name this something else? TerminateAllOnAnyFailure()? That's a bit wordy; perhaps something shorter would be better, if it was still clear.
In any event, documentation is needed here, especially the explanation on the need for exec to do process replacement if the posix function is not available (or if using it here does not work).
tests/cli/StopOnFailureCest.php
Outdated
| $I->amInPath(codecept_data_dir('sandbox')); | ||
| } | ||
|
|
||
| public function parallelProcessesGetStoppedIfStopOnFailIsSet(CliGuy $I) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice test. If posix_setpgid works, make a second test just like this one that does not use exec, and markTestSkipped if the posix commands are not available.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm sorry, I just realized I've never read you change request: can you explain me what you are asking for? I don't get it 😕
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added a summary of the requested changes. LMK if anything remains unclear.
37fbdc7 to
ec36551
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks like a very useful enhancement.
- The requirement for using
execmight not be clear to new users. Try usingposix_setpgidand see if you can stop the other processes even ifexecis not used. - This feature needs documentation. The requirement for
execshould be explained even ifposix_setpgidworks, because the code should operate even if the posix commands are not available. In this instance, users will need to employexec - Rename
stopOnFailto something else, as this feature behaves differently than the global stopOnFail flag. - The Codeception tests are no longer maintained in Robo. Please convert the test to phpunit (see the tests/integration directory)
- There should be two tests, one that uses exec (like the existing test), and another that does not. The second test should be skipped if the posix commands are not available.
ec36551 to
21c5fac
Compare
Since symfony/process@4ad0b86#diff-9a01fc0e340da4c3f1e4a16029a63977R296-R299
Done. I've also rebased the PR against |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, but PRs need to go into the default branch (3.x) first. Looks like this will probably rebase against 3.x without any trouble.
If you are going to backport it into If you are not going to backport it into |
Overview
This pull request:
Summary
ParallelExec is useful on CI to parallelize steps, but CI bill the time consumed, so it turns out that if one parallel process fails we can save money by stopping other parallel process too