-
-
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
[DX] Better and extensible way to configure parallel settings #3602
Conversation
06c9811
to
ad4d34f
Compare
@TomasVotruba @samsonasik any feedback on the approach here? |
This configs seems to expose value as changeable on the fly. That is active record pattern that could be hard to track. Instead, the config must be write-only as much as possible, so we can relly on it 100 %. If I understand correctly, there are 3 changes at once. Better do one change per PR, so they're easier to review and accept/decline, and avoid staling like this one. |
To me there are two, the renaming (I will extract the commit in a dedicated PR) and the use of a ParallelConfig to configure parallel related options.
I don't understand this feedback, could you elaborate please? |
Sure, this line exactly https://github.com/rectorphp/rector-src/pull/3602/files#diff-7670175f1f1c668d4a1611d0e211d616b84d433c7b8280f88900fe1445e5b792R53 Introduces fluent/ambiguous API that suggest this value should be changed on the fly. Why is this bad? I'd argue with reasons mentioned in https://ocramius.github.io/blog/fluent-interfaces-are-evil/ :) |
@TomasVotruba to be honest I would have liked to remove the parameter to just have
I totally agree! I'm not a fan of fluent interfaces neither for all the mentioned reasons :) Also, here issues with fluent interface don't apply I think:
To me this looks really clear from an end user perspective:
I can understand you don't have same opinion as the maintainer, maybe get more feedback from end users? Here the alternatives I can think of:
|
@TomasVotruba forgot to mention that I kept the parameters of |
->parallel()
is the onlyRectorConfig
shortcut with more than two parameters.Also, with the discussion opened in #3563, parallelization could get more settings.
Finally, I would like to also propose another parallel setting in another PR: job memory limit.
Before #3601, with memory limit being set in the command line, it always confused me that when you set a memory limit value it's the limit for each process, not a global limit, while it looks like it is.
If this get accepted, I plan to add a
->jobMemoryLimit($limit)
shortcut inParallelConfig
to be used by the worker command.I think this will make things clearer.
Here the allowed syntax:
Other potential ideas on top of this:
$rectorConfig->parallel()->disable();
$rectorConfig->parallel()->useAllProcesses();
shortcut$rectorConfig->parallel()->keepOneProcessFree();
shortcut, inspired by you @TomasVotruba (blog post)$rectorConfig->parallel()->separateProcessPerJob();