Skip to content

Invoke Parallel

Apostolis Bekiaris edited this page Apr 22, 2020 · 7 revisions

external help file: XpandPwsh.Cmdlets.dll-Help.xml Module Name: XpandPwsh online version: https://go.microsoft.com/fwlink/?LinkID=2097043 schema: 2.0.0

Invoke-Parallel

SYNOPSIS

Invokes tasks in parallel.

SYNTAX

Invoke-Parallel [-ActivityName <String>] [-Script] <ScriptBlock> [-VariablesToImport <String[]>]
 [-Value] <Object> [-ActivityId <Int32>] [-RetryOnError <Int32>] [-LimitConcurrency <Int32>]
 [-RetryDelay <Int32>] [-StepInterval <Int32>] [-First <Int32>] [<CommonParameters>]

DESCRIPTION

Invokes tasks in parallel. The function uses the System.Reactive library to handle parallelism.

EXAMPLES

Example 1

PS C:\> $psObj=[PSCustomObject]@{
    PackagesDirectory = (Get-Item "$PSScriptRoot\..\_third_party_assemblies\Packages").FullName
    packageSources=[system.string]::join(";",$packageSources)
    projects=$projects
} 
$nuget=Get-XNugetPath

$psObj.Projects|Invoke-XParallel -ActivityName "Restoring Nugets" -VariablesToImport @("psObj","nuget") -Script {
    & $nuget Restore $_ -PackagesDirectory $psObj.PackagesDirectory -source $psObj.packageSources
}

The above script restores in parallel all eXpandFrameowrk NuGets.

PARAMETERS

-ActivityId

{{ Fill ActivityId Description }}

Type: Int32
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-ActivityName

{{ Fill ActivityName Description }}

Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-First

Gets only the specified number of objects. Enter the number of objects to get.

Type: Int32
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-LimitConcurrency

{{ Fill LimitConcurrency Description }}

Type: Int32
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-RetryDelay

{{ Fill RetryDelay Description }}

Type: Int32
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-RetryOnError

{{ Fill RetryOnError Description }}

Type: Int32
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Script

{{ Fill Script Description }}

Type: ScriptBlock
Parameter Sets: (All)
Aliases:

Required: True
Position: 1
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-StepInterval

{{ Fill StepInterval Description }}

Type: Int32
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Value

{{ Fill Value Description }}

Type: Object
Parameter Sets: (All)
Aliases:

Required: True
Position: 0
Default value: None
Accept pipeline input: True (ByValue)
Accept wildcard characters: False

-VariablesToImport

{{ Fill VariablesToImport Description }}

Type: String[]
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

INPUTS

System.Object

OUTPUTS

System.Object

NOTES

RELATED LINKS

image

image


Star the project if you think it deserves it.

GitHub stars

Fork the project to extend and contribute.

GitHub forks

Clone this wiki locally