Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build_scoped_rector.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ jobs:
- run: rm -rf rector-build/rules-tests rector-build/templates rector-build/tests rector-build/scripts/validate-phpstan-version.php rector-build/vendor/tracy/tracy/examples rector-build/vendor/symfony/console/Tester rector-build/vendor/symfony/console/Event rector-build/vendor/symfony/console/EventListener rector-build/vendor/tracy/tracy/examples rector-build/vendor/tracy/tracy/src/Bridges rector-build/vendor/tracy/tracy/src/Tracy/Bar rector-build/vendor/tracy/tracy/src/Tracy/Session rector-build/vendor/symfony/service-contracts/Test

# 2. downgrade rector
- run: php -d memory_limit=-1 bin/rector process rector-build/bin rector-build/config rector-build/src rector-build/rules rector-build/vendor --config build/config/config-downgrade.php --ansi --no-diffs --lpt
- run: php -d memory_limit=-1 bin/rector process rector-build/bin rector-build/config rector-build/src rector-build/rules rector-build/vendor --config build/config/config-downgrade.php --ansi --no-diffs

# 3. prefix classes
- run: sh build/build-rector-scoped.sh rector-build rector-prefixed-downgraded
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/rector.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
- run: composer install --no-progress --ansi

## First run Rector - here can't be --dry-run !!! it would stop the job with it and not commit anything in the future
- run: bin/rector process --ansi --lpt
- run: bin/rector process --ansi

-
# commit only to core contributors who have repository access
Expand Down
349 changes: 0 additions & 349 deletions PARALLEL_LPT_POC_NOTES.md

This file was deleted.

20 changes: 17 additions & 3 deletions e2e/parallel-unfinished-jobs/expected-output.diff
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
1 file with changes
===================
2 files with changes
====================

1) src/File1.php:1

Expand All @@ -15,9 +15,23 @@ Applied rules:
* LongArrayToShortArrayRector


2) src/File4.php:1

---------- begin diff ----------
@@ Line 1 @@
<?php

-$items = array(4, 2);
+$items = [4, 2];
----------- end diff -----------

Applied rules:
* LongArrayToShortArrayRector


[ERROR] Could not process "src/File2.php" file, due to:
"Syntax error, unexpected ';'". On line: 3

[ERROR] Could not process some files, due to:
"Some parallel jobs have not finished, results for 2 of 4 files are
"Some parallel jobs have not finished, results for 1 of 4 files are
missing".
4 changes: 2 additions & 2 deletions e2e/parallel-unfinished-jobs/rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
__DIR__ . '/src',
]);

// the only worker ends on File3.php, so results for File3.php and File4.php are missing;
// the syntax error in File2.php must not hide that
// size-based scheduling processes File3.php last, where the only worker exits without reporting it;
// expect both File2.php's syntax error and a separate error for File3.php's missing result
$rectorConfig->parallel(maxNumberOfProcess: 1, jobSize: 1);

$rectorConfig->rules([
Expand Down
2 changes: 2 additions & 0 deletions e2e/parallel-unfinished-jobs/src/File2.php
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
<?php

$items = ;

// Keep this fixture larger than File3.php so LPT reports this syntax error before that worker exits.
72 changes: 36 additions & 36 deletions e2e/parallel-worker-respawn/expected-output.diff
Original file line number Diff line number Diff line change
@@ -1,168 +1,168 @@
12 files with changes
=====================

1) src/File01.php:1
1) src/File10.php:1

---------- begin diff ----------
@@ Line 1 @@
<?php

-$items = array(1, 2);
+$items = [1, 2];
-$items = array(10, 2);
+$items = [10, 2];
----------- end diff -----------

Applied rules:
* LongArrayToShortArrayRector


2) src/File02.php:1
2) src/File11.php:1

---------- begin diff ----------
@@ Line 1 @@
<?php

-$items = array(2, 2);
+$items = [2, 2];
-$items = array(11, 2);
+$items = [11, 2];
----------- end diff -----------

Applied rules:
* LongArrayToShortArrayRector


3) src/File03.php:1
3) src/File12.php:1

---------- begin diff ----------
@@ Line 1 @@
<?php

-$items = array(3, 2);
+$items = [3, 2];
-$items = array(12, 2);
+$items = [12, 2];
----------- end diff -----------

Applied rules:
* LongArrayToShortArrayRector


4) src/File04.php:1
4) src/File01.php:1

---------- begin diff ----------
@@ Line 1 @@
<?php

-$items = array(4, 2);
+$items = [4, 2];
-$items = array(1, 2);
+$items = [1, 2];
----------- end diff -----------

Applied rules:
* LongArrayToShortArrayRector


5) src/File05.php:1
5) src/File02.php:1

---------- begin diff ----------
@@ Line 1 @@
<?php

-$items = array(5, 2);
+$items = [5, 2];
-$items = array(2, 2);
+$items = [2, 2];
----------- end diff -----------

Applied rules:
* LongArrayToShortArrayRector


6) src/File06.php:1
6) src/File03.php:1

---------- begin diff ----------
@@ Line 1 @@
<?php

-$items = array(6, 2);
+$items = [6, 2];
-$items = array(3, 2);
+$items = [3, 2];
----------- end diff -----------

Applied rules:
* LongArrayToShortArrayRector


7) src/File07.php:1
7) src/File04.php:1

---------- begin diff ----------
@@ Line 1 @@
<?php

-$items = array(7, 2);
+$items = [7, 2];
-$items = array(4, 2);
+$items = [4, 2];
----------- end diff -----------

Applied rules:
* LongArrayToShortArrayRector


8) src/File08.php:1
8) src/File05.php:1

---------- begin diff ----------
@@ Line 1 @@
<?php

-$items = array(8, 2);
+$items = [8, 2];
-$items = array(5, 2);
+$items = [5, 2];
----------- end diff -----------

Applied rules:
* LongArrayToShortArrayRector


9) src/File09.php:1
9) src/File06.php:1

---------- begin diff ----------
@@ Line 1 @@
<?php

-$items = array(9, 2);
+$items = [9, 2];
-$items = array(6, 2);
+$items = [6, 2];
----------- end diff -----------

Applied rules:
* LongArrayToShortArrayRector


10) src/File10.php:1
10) src/File07.php:1

---------- begin diff ----------
@@ Line 1 @@
<?php

-$items = array(10, 2);
+$items = [10, 2];
-$items = array(7, 2);
+$items = [7, 2];
----------- end diff -----------

Applied rules:
* LongArrayToShortArrayRector


11) src/File11.php:1
11) src/File08.php:1

---------- begin diff ----------
@@ Line 1 @@
<?php

-$items = array(11, 2);
+$items = [11, 2];
-$items = array(8, 2);
+$items = [8, 2];
----------- end diff -----------

Applied rules:
* LongArrayToShortArrayRector


12) src/File12.php:1
12) src/File09.php:1

---------- begin diff ----------
@@ Line 1 @@
<?php

-$items = array(12, 2);
+$items = [12, 2];
-$items = array(9, 2);
+$items = [9, 2];
----------- end diff -----------

Applied rules:
Expand Down
2 changes: 1 addition & 1 deletion e2e/parallel-worker-respawn/rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
__DIR__ . '/src',
]);

// a single worker with more single-file jobs than its chunk budget (MAX_CHUNKS_PER_WORKER + 1) has to be respawned mid-run
// a persistent worker must finish all chunks, including workloads larger than the former respawn budget
$rectorConfig->parallel(maxNumberOfProcess: 1, jobSize: 1);

$rectorConfig->rules([
Expand Down
8 changes: 1 addition & 7 deletions phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -192,12 +192,6 @@ parameters:
identifier: greaterOrEqual.alwaysTrue
message: '#Comparison operation ".*" between int<\d+, \d+> and \d+ is always true#'

# known value object, nullable due to typed property
-
identifier: method.nonObject
message: '#Cannot call method (.*?)\(\) on (.*?)\\ProcessPool\|null#'
path: src/Parallel/Application/ParallelFileProcessor.php

# required generics on interface array, not helpful
-
identifier: missingType.generics
Expand Down Expand Up @@ -361,7 +355,7 @@ parameters:
- src/BetterPhpDocParser/PhpDocManipulator/PhpDocClassRenamer.php
- src/NodeTypeResolver/PHPStan/Type/TypeFactory.php
- rules/CodeQuality/NodeAnalyzer/VariableDimFetchAssignResolver.php
- src/Parallel/Experimental/ExperimentalParallelFileProcessor.php
- src/Parallel/Application/ParallelFileProcessor.php

-
identifier: symplify.noNullableServiceInConstructor
Expand Down
22 changes: 0 additions & 22 deletions src/Application/ApplicationFileProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
use Rector\Parallel\Application\ParallelFileProcessor;
use Rector\Parallel\CpuCoreCountProvider;
use Rector\Parallel\Exception\ParallelShouldNotHappenException;
use Rector\Parallel\Experimental\ExperimentalParallelFileProcessor;
use Rector\Parallel\Experimental\LptScheduleFactory;
use Rector\Parallel\ScheduleFactory;
use Rector\PhpParser\Parser\ParserErrors;
use Rector\Reporting\MissConfigurationReporter;
Expand Down Expand Up @@ -53,9 +51,6 @@ public function __construct(
private readonly ArrayParametersMerger $arrayParametersMerger,
private readonly MissConfigurationReporter $missConfigurationReporter,
private readonly Skipper $skipper,
// @experimental, see --lpt
private readonly LptScheduleFactory $lptScheduleFactory,
private readonly ExperimentalParallelFileProcessor $experimentalParallelFileProcessor,
) {
}

Expand Down Expand Up @@ -273,23 +268,6 @@ private function runParallel(
Option::PARALLEL_MAX_NUMBER_OF_PROCESSES
);

// @experimental opt-in, see --lpt
if ($input->hasOption(Option::LPT) && (bool) $input->getOption(Option::LPT)) {
$bucketSchedule = $this->lptScheduleFactory->create(
$cpuCores,
$jobSize,
$maxNumberOfProcesses,
$filePaths
);

return $this->experimentalParallelFileProcessor->process(
$bucketSchedule,
$mainScript,
$postFileCallback,
$input
);
}

$schedule = $this->scheduleFactory->create($cpuCores, $jobSize, $maxNumberOfProcesses, $filePaths);

// mimics see https://github.com/phpstan/phpstan-src/commit/9124c66dcc55a222e21b1717ba5f60771f7dda92#diff-387b8f04e0db7a06678eb52ce0c0d0aff73e0d7d8fc5df834d0a5fbec198e5daR139
Expand Down
6 changes: 0 additions & 6 deletions src/Configuration/Option.php
Original file line number Diff line number Diff line change
Expand Up @@ -184,12 +184,6 @@ final class Option
*/
public const string PARALLEL_JOB_TIMEOUT_IN_SECONDS = 'parallel-job-timeout-in-seconds';

/**
* @experimental Opt-in to the LPT bucket scheduler
* @see \Rector\Parallel\Experimental\LptScheduleFactory
*/
public const string LPT = 'lpt';

public const string MEMORY_LIMIT = 'memory-limit';

/**
Expand Down
7 changes: 0 additions & 7 deletions src/Console/ProcessConfigureDecorator.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,13 +99,6 @@ public static function decorate(Command $command): void
$command->addOption(Option::PARALLEL_PORT, null, InputOption::VALUE_REQUIRED);
$command->addOption(Option::PARALLEL_IDENTIFIER, null, InputOption::VALUE_REQUIRED);

$command->addOption(
Option::LPT,
null,
InputOption::VALUE_NONE,
'[EXPERIMENTAL] Balance files across parallel workers by size up front and keep every worker alive for its whole share.'
);

$command->addOption(Option::XDEBUG, null, InputOption::VALUE_NONE, 'Display xdebug output.');

$command->addOption(
Expand Down
Loading
Loading