[DX] Better and extensible way to configure parallel settings#3602
[DX] Better and extensible way to configure parallel settings#3602yguedidi wants to merge 2 commits intorectorphp:mainfrom
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 onlyRectorConfigshortcut 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 inParallelConfigto 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();