Repository navigation
ParallelKit 2.3
After updating, start a new PowerShell window, so nothing from the older copy is left in your session.
New
- Faster with short programs and short jobs. The dispatch and runspace loops now wake as soon as a job finishes, instead of sleeping between checks. One slot running a very short program went from about 106 ms per program to about 19 ms, and a 20 ms runspace job from about 102 ms to 23 ms. (#31)
- A time limit per job in
Invoke-PkProcessDispatch.-TimeoutSecondssets it for every job, and aTimeoutSecondskey on a job overrides it (0 means no limit). A job that runs over has its program and everything it started killed, and goes through-JobFinalizewith$job['TimedOut'] = $true.Invoke-PkProcessBatchalso takes aTimeoutSecondskey per command now. (#32) Argumentstakes a list, one argument per element, quoted for you:Arguments = @($in, $out)works with spaces in the paths. This works for every function that takesArguments. (#34)- Each engine accepts the other's names for its limits.
-MaxParallel/-MaxConcurrentand-DrainTimeoutSeconds/-AbortTimeoutSecondswork on every engine. (#35)
Changes you might notice
- Callbacks that run on every loop pass run more often with fast jobs:
-PollCallback,-AbortPollCallbackand-GroupReleaseCheck. (#31) - A retry queued from
-JobFinalizecan start within milliseconds of the failure, instead of about 125 ms later. (#31) - Dispatchers sharing one
SemaphoreSlimgain less speed than one with its own limit, because they pause to take turns. (#31) - A job field named
TimeoutSecondsnow sets the kit's time limit, and a value that isn't a number fails that job's start.TimedOut,TimeLimitandStartFailureReportedare now reserved job keys. (#32) - Repeated start failures in a batch print once. If the same program can't start for many commands, the first failure prints in full and a count follows at the end, so a message handler that counted one line per command sees fewer. Each command still gets its
StartError. (#33) - A list in
Argumentsis no longer joined as-is. A list of command-line pieces that are already quoted (@('"C:\My Files\a.png"', 'out.jxl')) now passes the quote characters on to the program. Pass such a command line as one string instead.$nullelements are left out, byConvertTo-PkArgumentStringtoo. (#34) - Arguments holding
& | < > ^ ( ) , ;are quoted, byConvertTo-PkArgumentStringand so by a list inArguments. A.bator.cmdprogram now gets such an argument as one argument instead ofcmd.exeacting on it (a&verused to runver). Programs that follow the usual Windows rules see no change. A list passed tocmd.exe /cnow has those arguments quoted, a program that reads its raw command line sees the quotes, and a trailing backslash in such an argument reaches a batch file doubled. (#36) - Unknown arguments are now an error on the seven public functions that used to ignore them, so a typo like
Initialize-ParallelKit -MaxParallel 8no longer passes silently. (#35) Invoke-PkRunspaceJobs -Abort ...is now an error. It used to resolve to-AbortWaitMessage, but the new-AbortTimeoutSecondsalias makes it ambiguous. Write-AbortWaitMessagein full. (#35)
Fixed
Invoke-PkProcessBatch -TimeoutSecondsbelow 1 meant no limit. It was rounded to a whole number, so0.4became 0 and nothing was ever timed out. It now takes fractions. (#32)$OFScould change a command line. A list inArgumentswas joined with$OFS, so a script that set it got different arguments. (#34)- A hashtable in
Argumentsreached the program as the textSystem.Collections.Hashtable. It's now an error before anything starts:Arguments must be one string or a list of arguments. So is a list inside the list, which used to become one argument joined with$OFS. (#34, #37) - A file object in
Argumentsbecame just its name on Windows PowerShell 5.1. AGet-ChildItemresult reached the program asa.pnginstead of its full path, so the program looked for it in the wrong folder. File and folder objects are now passed as their full path on 5.1 and 7, and toConvertTo-PkArgumentString. (#37) Invoke-PkProcessBatch -MaxConcurrent 0failed with an error namingInvoke-PkProcessDispatch. It now names the batch. (#35)