Skip to content
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

[config] Extract RectorConfigValidator and handle config validation there #5404

Merged
merged 2 commits into from Dec 31, 2023

Conversation

TomasVotruba
Copy link
Member

No description provided.

@@ -81,7 +83,7 @@ public function enableCollectors(): void
SimpleParameterProvider::setParameter(Option::COLLECTORS, true);
}

public function parallel(int $seconds = 120, int $maxNumberOfProcess = 16, int $jobSize = 15): void
public function parallel(int $seconds = 120, int $maxNumberOfProcess = 32, int $jobSize = 20): void
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's stay with PHPStan default to avoid per-project upgrades of this file:
https://phpstan.org/config-reference#parallel-processing

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

iirc, 15 is to make less memory, /cc @staabm ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are designed be configured per project as differt by OS, machine and project. Also low memory is not the goal, usually speed is. Let's stay in sync with PHPStan to keep it simple.

Copy link
Contributor

@staabm staabm Jan 1, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rector has very different usage pattern of memory.

these numbers were used to allow running rector on big projects without endless amounts of memory.
I don't think its a good idea to change this numbers without a motivation/goal

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also low memory is not the goal, usually speed is.

its not about "low memory". its about sucking all RAM out of a system and running into swap, which turns the system to be super slow

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see e.g. https://github.com/complex-gmbh/daiber/pull/5531 in which github actions run into timeouts with the new config, but ran successfully with the previous defaults

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@TomasVotruba I think rollback to previous config is better, since the previous version is with @staabm experience on big project and large files on his PR with max chunk per-worker set:

also I test that 60 seconds timeout seems timeout on CodeIgniter4 project

https://github.com/codeigniter4/CodeIgniter4/actions/runs/7462946128/job/20306475124#step:9:11

set to 120 second solve it.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are project specific values, there is no reason to promote them to default as we do not have data about average Rector usage nor runtime. On a different project setting higher values would lead to late feedback, etc.

Customize those values to fit the particular project.

'The services() method is deprecated. Use $rectorConfig->singleton(ServiceType::class) instead',
E_USER_ERROR
);
}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is no longer needed 👍

@TomasVotruba TomasVotruba force-pushed the tv-validate-config branch 3 times, most recently from f674af2 to 6700e1c Compare December 31, 2023 19:51
@TomasVotruba TomasVotruba merged commit 0ba4706 into main Dec 31, 2023
42 checks passed
@TomasVotruba TomasVotruba deleted the tv-validate-config branch December 31, 2023 19:52
@rectorphp rectorphp locked as resolved and limited conversation to collaborators Jan 9, 2024
@TomasVotruba
Copy link
Member Author

Closing to avoid further back and forth changes. Customize per project.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
3 participants