-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow to configure parallel processing (#92)
- Loading branch information
Showing
8 changed files
with
87 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
includes: | ||
- phpstan_parallel_settings.php | ||
|
||
services: | ||
- | ||
class: EonX\EasyQuality\PHPStan\ThrowExceptionMessageRule | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?php | ||
declare(strict_types=1); | ||
|
||
use EonX\EasyQuality\Helper\ParallelSettingsHelper; | ||
|
||
$config = []; | ||
$config['parameters']['parallel'] = [ | ||
'jobSize' => ParallelSettingsHelper::getJobSize(), | ||
'maximumNumberOfProcesses' => ParallelSettingsHelper::getMaxNumberOfProcess(), | ||
'processTimeout' => (float)ParallelSettingsHelper::getTimeoutSeconds(), | ||
]; | ||
|
||
return $config; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<?php | ||
declare(strict_types=1); | ||
|
||
namespace EonX\EasyQuality\Helper; | ||
|
||
final class ParallelSettingsHelper | ||
{ | ||
private const DEFAULT_JOB_SIZE = 2; | ||
|
||
private const DEFAULT_MAX_NUMBER_OF_PROCESS = 4; | ||
|
||
private const DEFAULT_TIMEOUT_SECONDS = 120; | ||
|
||
private const ENV_JOB_SIZE = 'EONX_EASY_QUALITY_JOB_SIZE'; | ||
|
||
private const ENV_MAX_NUMBER_OF_PROCESS = 'EONX_EASY_QUALITY_MAX_NUMBER_OF_PROCESS'; | ||
|
||
private const ENV_TIMEOUT_SECONDS = 'EONX_EASY_QUALITY_TIMEOUT_SECONDS'; | ||
|
||
public static function getJobSize(): int | ||
{ | ||
$jobSize = \getenv(self::ENV_JOB_SIZE); | ||
|
||
return $jobSize ? (int)$jobSize : self::DEFAULT_JOB_SIZE; | ||
} | ||
|
||
public static function getMaxNumberOfProcess(): int | ||
{ | ||
$maxNumberOfProcess = \getenv(self::ENV_MAX_NUMBER_OF_PROCESS); | ||
|
||
return $maxNumberOfProcess ? (int)$maxNumberOfProcess : self::DEFAULT_MAX_NUMBER_OF_PROCESS; | ||
} | ||
|
||
public static function getTimeoutSeconds(): int | ||
{ | ||
$timeoutSeconds = \getenv(self::ENV_TIMEOUT_SECONDS); | ||
|
||
return $timeoutSeconds ? (int)$timeoutSeconds : self::DEFAULT_TIMEOUT_SECONDS; | ||
} | ||
} |