Releases: santisq/PSParallelPipeline
v1.2.2
What's Changed
-
Lot of refactoring done to the cmdlet to improve responsiveness and efficiency.
-
The cmdlet now throws when passing a function that could not be found in the user's scope.
PS ..\> Invoke-Parallel { } -Function NotExist Invoke-Parallel: The function with name 'NotExist' could not be found.
Full Changelog: v1.2.1...v1.2.2
v1.2.1
v1.2.0
What's Changed
- This version version improves the logic of the RunspacePool when re-using runspaces. Prior version would be creating runspaces when it may not be needed, for example, when a parallel invocation ends instantly.
Full Changelog: v1.1.9...v1.2.0
v1.1.9
What's Changed
- Fixes a bug where the cmdlet would not be correctly disposing Runspaces in scenarios where a
PipelineStoppedException
was thrown (CTRL+C /Select-Object -First
) andOperationCanceledException
(Timeout reached) by @santisq in #38
Full Changelog: v1.1.8...v1.1.9
v1.1.8
What's Changed
- Fixes a bug where the cmdlet would not be correctly disposing Runspaces in scenarios where a
PipelineStoppedException
was thrown (CTRL+C /Select-Object -First
) andOperationCanceledException
(Timeout reached) by @santisq in #36
Full Changelog: v1.1.7...v1.1.8
v1.1.7
What's Changed
-
Fixes incorrect error message on passed ScriptBlock by
-Variables
by @santisq in #34-
Invoke-Parallel v1.1.6
PS \> $null | Invoke-Parallel { $var } -Variables @{ var = {} } # Invoke-Parallel: A $using: variable cannot be a script block. Passed-in script block variables are not supported, and can result in undefined behavior.
-
Invoke-Parallel v1.1.7
PS \> $null | Invoke-Parallel { $var } -Variables @{ var = {} } # Invoke-Parallel: Passed-in script block variables are not supported, and can result in undefined behavior.
-
Full Changelog: v1.1.6...v1.1.7
v1.1.6
What's Changed
- Refactoring Module to C# by @santisq in #22
coverlet.console
support for Linux tests by @santisq in #27- Updates
ci.yml
forcodecov/codecov-action@v4
by @santisq in #28 - Organized and added new Pester tests by @santisq in #29
- Documentation Updates by @santisq in #31
v1.1.6
Details
Re-implements Invoke-Parallel
in C#. This new version shares the same capabilities as the previous one and offers the following improvements:
Pipeline streaming capabilities
Invoke-Parallel v1.1.5
Measure-Command {
1 | Invoke-Parallel { 0..10 | ForEach-Object { Start-Sleep 1; $_ } } | Select-Object -First 1
} | Select-Object TotalSeconds
# TotalSeconds
# ------------
# 11.10
Invoke-Parallel v1.1.6
Measure-Command {
1 | Invoke-Parallel { 0..10 | ForEach-Object { Start-Sleep 1; $_ } } | Select-Object -First 1
} | Select-Object TotalSeconds
# TotalSeconds
# ------------
# 1.06
Support for CommonParameters
ForEach-Object v7.5.0.3
This is something missing on ForEach-Object -Parallel
as of v7.5.0.3
.
PS \> 0..5 | ForEach-Object -Parallel { Write-Error $_ } -ErrorAction Stop
# ForEach-Object: The following common parameters are not currently supported in the Parallel parameter set:
# ErrorAction, WarningAction, InformationAction, PipelineVariable
Invoke-Parallel v1.1.6
A few examples, they should all work properly, please submit an issue if not 😅.
PS \> 0..5 | Invoke-Parallel { Write-Error $_ } -ErrorAction Stop
# Invoke-Parallel: 0
PS \> 0..5 | Invoke-Parallel { Write-Warning $_ } -WarningAction Stop
# WARNING: 1
# Invoke-Parallel: The running command stopped because the preference variable "WarningPreference" or common parameter is set to Stop: 1
PS \> 0..5 | Invoke-Parallel { $_ } -PipelineVariable pipe | ForEach-Object { "[$pipe]" }
# [0]
# [1]
# [5]
# [2]
# [3]
# [4]
Input Script Block check
This check was missing in previous version.
PS \> { 1 + 1 } | Invoke-Parallel { & $_ }
# Invoke-Parallel: Piped input object cannot be a script block. Passed-in script block variables are not supported, and can result in undefined behavior.
Improved Script Block checks for variables passed in via $using:
keyword
Invoke-Parallel v1.1.5
PS \> $var = @{ foo = @{ bar = { 1 + 1 } }}
PS \> 1 | Invoke-Parallel { & $using:var['foo']['bar'] }
# 2
Invoke-Parallel v1.1.6
PS \> $var = @{ foo = @{ bar = { 1 + 1 } }}
PS \> 1 | Invoke-Parallel { & $using:var['foo']['bar'] }
# Invoke-Parallel: A $using: variable cannot be a script block. Passed-in script block variables are not supported, and can result in undefined behavior.
Improved -TimeOutSeconds
error message
Invoke-Parallel v1.1.5
PS \> 0..10 | Invoke-Parallel { $_; Start-Sleep 5 } -TimeoutSeconds 3
# Invoke-Parallel: The pipeline has been stopped.
# Invoke-Parallel: The pipeline has been stopped.
# Invoke-Parallel: The pipeline has been stopped.
# Invoke-Parallel: The pipeline has been stopped.
# Invoke-Parallel: The pipeline has been stopped.
Invoke-Parallel v1.1.6
PS \> 0..10 | Invoke-Parallel { $_; Start-Sleep 5 } -TimeoutSeconds 3
# 0
# 1
# 3
# 2
# 4
# Invoke-Parallel: Timeout has been reached.
Accept $null
as input
Same as ForEach-Object -Parallel
, now you can pipe $null
to this cmdlet.
PS \> $null | Invoke-Parallel { 'hi' }
# hi
New parameter aliases
Parameter | Alias |
---|---|
ThrottleLimit |
tl |
TimeOutSeconds |
to |
Variables |
vars |
Functions |
funcs |
UseNewRunspace |
unr |
Full Changelog: v1.1.5...v1.1.6
v1.1.5
What's Changed
This release adds support to properly handle property and index accessing on using:
statements. v1.1.4
added support for index accessing however accessing of properties was not working properly. This release fixes that, including nested accessing. Example:
$test = @{
foo = @{
bar = [pscustomobject]@{ baz = 0..10 }
}
}
1 | Invoke-Parallel { $using:test['foo']['bar'].baz[5] } # Outputs: 5
Full Changelog: v1.1.4...v1.1.5
v1.1.4
What's Changed
-
Fixes indexing on
$using:
statements by @santisq in #18This update allows proper index on
$using:
statements, for example:$arr = 0..10; $hash = @{ foo = 'bar' } 1 | Invoke-Parallel { $using:hash['foo'] + ' ' + $using:arr[5] + $_ } # Outputs: # bar 51
In previoues version this would fail with:
Invoke-Parallel
: Exception calling "GetValue" with "1" argument(s): "Cannot process argument because the value of argument "path" is not valid. Change the value of the "path" argument and run the operation again."Thanks to @jborean93 for catching and helping fixing this bug.
Full Changelog: v1.1.3...v1.1.4
v1.1.3
What's Changed
- Added check to validate if a scriptblock is being passed to the parallel scope either through
using:
scope modifier or-Varables
parameter. In both cases there will be a terminating error. - Added pester tests.
Full Changelog: v.1.1.2...v1.1.3