| 1 | <?php |
||
| 2 | |||
| 3 | /** |
||
| 4 | * This file is part of graze/parallel-process. |
||
| 5 | * |
||
| 6 | * Copyright © 2018 Nature Delivered Ltd. <https://www.graze.com> |
||
| 7 | * |
||
| 8 | * For the full copyright and license information, please view the LICENSE |
||
| 9 | * file that was distributed with this source code. |
||
| 10 | * |
||
| 11 | * @license https://github.com/graze/parallel-process/blob/master/LICENSE.md |
||
| 12 | * @link https://github.com/graze/parallel-process |
||
| 13 | */ |
||
| 14 | |||
| 15 | $composer = require_once __DIR__ . '/../../vendor/autoload.php'; |
||
| 16 | $composer->setUseIncludePath(true); |
||
| 17 | |||
| 18 | use Graze\ParallelProcess\Display\Table; |
||
| 19 | use Symfony\Component\Console\Output\ConsoleOutput; |
||
| 20 | use Symfony\Component\Process\Process; |
||
| 21 | |||
| 22 | $output = new ConsoleOutput(ConsoleOutput::VERBOSITY_VERY_VERBOSE); |
||
| 23 | |||
| 24 | $pool = new \Graze\ParallelProcess\PriorityPool(); |
||
| 25 | $pool->setMaxSimultaneous(3); |
||
| 26 | for ($i = 0; $i < 5; $i++) { |
||
| 27 | $time = $i + 5; |
||
| 28 | $pool->add(new Process(sprintf('for i in `seq 1 %d` ; do date ; sleep 1 ; done', $time)), ['sleep' => $time]); |
||
|
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||
| 29 | } |
||
| 30 | $table = new Table($output, $pool); |
||
| 31 | $table->run(); |
||
| 32 |