-
-
Notifications
You must be signed in to change notification settings - Fork 356
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
Configure max processes by free ones #3615
Configure max processes by free ones #3615
Conversation
@TomasVotruba @samsonasik any feedback on this? :) |
Could you extend test as well? |
@TomasVotruba could you point me to the test to extend? didn't manage to find it. Or if it's a new kind of test, what would be the best approach? |
Basically extend or add |
@TomasVotruba not sure I get you 😕 |
It will need a test coverage. That might require a bit refactoring, so testing is easier :) |
Good that you're open to some refactoring! Will come with a solution when I'll have time ;) |
c7c3433
to
77a0333
Compare
@TomasVotruba done! :) |
cb670c2
to
5d79f19
Compare
@@ -50,7 +50,7 @@ public function disableParallel(): void | |||
$parameters->set(Option::PARALLEL, false); | |||
} | |||
|
|||
public function parallel(int $seconds = 120, int $maxNumberOfProcess = 16, int $jobSize = 20): void | |||
public function parallel(int $seconds = 120, int $maxNumberOfProcess = 0, int $jobSize = 20): void |
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.
since the parameter $maxNumberOfProcess
now has in-depth semantics I think we need a phpdoc explaining the different use-cases one can do with 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.
very good idea! phpdoc added, ping @TomasVotruba
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.
Thanks 👍
I don't understand this part:
and a negative one to preserve that number of CPU cores.
Feels like magic. The value here should be only positive integer.
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.
@TomasVotruba thanks for the feedback! what would be your ideal API to configure preserving CPU cores?
To me it feels logical, I read "$maxNumberOfProcess = -1" as "minus one CPU core from all available CPU cores", or in a more lengthy way "perserve one CPU core amoung all available CPU cores"
Any idea how to make this clearer?
It would be too much and confusing to add a new parameter for this preserve configuration IMO.
Goal is to provide a persistent configuration among a dev team, where devs don't have the same number of CPU cores on their laptop.
5d79f19
to
d542b75
Compare
d542b75
to
9e7fbed
Compare
@TomasVotruba @samsonasik anything else needed to have this merged? |
@TomasVotruba @samsonasik friendly reminder on this, it looks ready. I don't want to look too pushy sorry 😅 |
I will let @TomasVotruba decide on this :) |
Thanks for the update. I get the idea and I like it. Like having max speed of - 20 k/h. Could be slow down? Or going backwords? Or reverse in the instant speed? Saying that, I'm closing this one untill we find a better way. |
@TomasVotruba the use of negative is inspired by PHP itself, see substr length parameter It's the best compromise I managed to find between being BC compliant (existing config behavior will not change), relatively understandable, and bringing the feature to life inspired by your blog post. If you have any better idea to configure it please tell me |
@TomasVotruba maybe the issue is on the "max" wording? what if the parameter become just
What do you think? |
what about adding a new method for the use-case? |
@TomasVotruba before I rework this, please give me a configuration API you will accept. seems you liked the proposal of @staabm about using a new method, but what would be its name? Again, to me it's more complex for end users to have to configure something related to parallelism in a separate method. @TomasVotruba any feedback on above hypothesis #3615 (comment) that the confusion may come from the current "max" naming? Maybe removing it from the name will at least reduce the confusion? Thank you for your patience |
inspired by https://tomasvotruba.com/blog/hidden-productivity-costs-of-parallel-run