Skip to content

Latest commit

 

History

History
29 lines (25 loc) · 1014 Bytes

File metadata and controls

29 lines (25 loc) · 1014 Bytes

Run different scripts with different parameters and do nothing (run and forget)

<?php
    use \JustMisha\MultiRunner\ScriptMultiRunner;

    $maxParallelProcesses = 512;    //  determined by the machine on which it is runs
    $runner = DiffScriptMultiRunner($maxParallelProcesses);
    
    $arg1 = 'something';
    $arg2 = 'anotherThing';

    try {
        $runner->addProcess('phpScript', "phpScriptFileName", "phpScriptDirFullPath", 'php', [], null, $arg1, $arg2);
    } catch (RuntimeException $e) {
        // handle a runtime exception
    }
    try {
        $runner->addProcess('pythonScript', "pythonScriptFileName", "pythonScriptDirFullPath", 'python', [], null, $arg1, $arg2);
    } catch (RuntimeException $e) {
        // handle a runtime exception
    }
    
    $timeout = 15; // Timeout in seconds, depending on the machine it is running on.
    try {
        $results = $runner->runAndForget($timeout);
    } catch (RuntimeException $t) {
        // handle a runtime exception
    }