Skip to content

v2.3

Latest

Choose a tag to compare

@HalRiveria HalRiveria released this 06 Nov 15:25
3bb8a0a

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. -TimeoutSeconds sets it for every job, and a TimeoutSeconds key 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 -JobFinalize with $job['TimedOut'] = $true. Invoke-PkProcessBatch also takes a TimeoutSeconds key per command now. (#32)
  • Arguments takes a list, one argument per element, quoted for you: Arguments = @($in, $out) works with spaces in the paths. This works for every function that takes Arguments. (#34)
  • Each engine accepts the other's names for its limits. -MaxParallel/-MaxConcurrent and -DrainTimeoutSeconds/-AbortTimeoutSeconds work on every engine. (#35)

Changes you might notice

  • Callbacks that run on every loop pass run more often with fast jobs: -PollCallback, -AbortPollCallback and -GroupReleaseCheck. (#31)
  • A retry queued from -JobFinalize can start within milliseconds of the failure, instead of about 125 ms later. (#31)
  • Dispatchers sharing one SemaphoreSlim gain less speed than one with its own limit, because they pause to take turns. (#31)
  • A job field named TimeoutSeconds now sets the kit's time limit, and a value that isn't a number fails that job's start. TimedOut, TimeLimit and StartFailureReported are 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 Arguments is 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. $null elements are left out, by ConvertTo-PkArgumentString too. (#34)
  • Arguments holding & | < > ^ ( ) , ; are quoted, by ConvertTo-PkArgumentString and so by a list in Arguments. A .bat or .cmd program now gets such an argument as one argument instead of cmd.exe acting on it (a&ver used to run ver). Programs that follow the usual Windows rules see no change. A list passed to cmd.exe /c now 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 8 no longer passes silently. (#35)
  • Invoke-PkRunspaceJobs -Abort ... is now an error. It used to resolve to -AbortWaitMessage, but the new -AbortTimeoutSeconds alias makes it ambiguous. Write -AbortWaitMessage in full. (#35)

Fixed

  • Invoke-PkProcessBatch -TimeoutSeconds below 1 meant no limit. It was rounded to a whole number, so 0.4 became 0 and nothing was ever timed out. It now takes fractions. (#32)
  • $OFS could change a command line. A list in Arguments was joined with $OFS, so a script that set it got different arguments. (#34)
  • A hashtable in Arguments reached the program as the text System.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 Arguments became just its name on Windows PowerShell 5.1. A Get-ChildItem result reached the program as a.png instead 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 to ConvertTo-PkArgumentString. (#37)
  • Invoke-PkProcessBatch -MaxConcurrent 0 failed with an error naming Invoke-PkProcessDispatch. It now names the batch. (#35)