Skip to content

Conversation

@powercode
Copy link
Collaborator

@powercode powercode commented Nov 26, 2020

PR Summary

Forwarding progress stream changes from Foreach-Object -Parallel runspaces in the same way as the other streams.
#14254

PR Context

Now looks like this.
That it doesn't render perfectly is a separate issue.

function Show-Progress {
    param([int] $ThrottleLimit = 4)
    $parentId = 100
    Write-Progress -Id $parentId -Activity Parent -status Parallel
    1..20 | Foreach-Object -ThrottleLimit $ThrottleLimit -Parallel {
        $progress = @{
            Id               = $_
            Activity         = "Activity $_"
            CurrentOperation = "Operation $_"
            PercentComplete  = 0
            ParentId         = $using:parentId
        }
        
        Write-Progress @progress
        Start-sleep -Seconds 1
        $id
        foreach ($p in 1..100) {
            $progress.PercentComplete = $p
            Write-Progress @progress
            Start-Sleep -Milliseconds 100
        }
        start-sleep -Seconds 1
        Write-Progress @progress -Completed
    }         
    Write-Progress -Id 1 -Acti Parent -completed
}

image

image

The test looks different as the Progress stream is not forwardable. So the API is used instead.

PR Checklist

@ghost ghost assigned iSazonov Nov 26, 2020
@iSazonov iSazonov requested a review from PaulHigin November 26, 2020 16:16
@iSazonov iSazonov added the CL-General Indicates that a PR should be marked as a general cmdlet change in the Change Log label Nov 26, 2020
@iSazonov
Copy link
Collaborator

@powercode Please add some example scripts/screenshot.
And we need test(s).

@ghost ghost added the Review - Needed The PR is being reviewed label Dec 4, 2020
@ghost
Copy link

ghost commented Dec 4, 2020

This pull request has been automatically marked as Review Needed because it has been there has not been any activity for 7 days.
Maintainer, please provide feedback and/or mark it as Waiting on Author

@tlsalex
Copy link

tlsalex commented Jan 25, 2021

A few days had passed , the fix still on its way ?

Copy link
Contributor

@PaulHigin PaulHigin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM @powercode Thanks for adding this!

…bject-Parallel.Tests.ps1

Co-authored-by: Ilya <darpa@yandex.ru>
@tlsalex
Copy link

tlsalex commented Jul 28, 2021

34 successful and 1 expected checks

what action need to take for the 1 "expected checks" ?

@tlsalex
Copy link

tlsalex commented Jul 31, 2021

@powercode could you help to compile latest Powershell code but with your fix for windows x64 ? I want to use this feature before official release . I am not a code man , I don't know how to compile it. thanks !

@iSazonov iSazonov closed this Jul 31, 2021
@ghost ghost removed the Review - Needed The PR is being reviewed label Jul 31, 2021
@iSazonov iSazonov reopened this Jul 31, 2021
@iSazonov
Copy link
Collaborator

@tlsalex You can download build.zip from CIs.

@iSazonov
Copy link
Collaborator

/rebase

@iSazonov iSazonov changed the title Fixes #14254: foreach -Parallel does not display progress Forwarding progress stream changes from Foreach-Object -Parallel runspaces Jul 31, 2021
@iSazonov iSazonov merged commit 1bfa1c3 into PowerShell:master Jul 31, 2021
@iSazonov iSazonov added this to the 7.2.0-preview.9 milestone Jul 31, 2021
@powercode powercode deleted the parallel_progress branch August 16, 2021 14:07
@ghost
Copy link

ghost commented Aug 23, 2021

🎉v7.2.0-preview.9 has been released which incorporates this pull request.:tada:

Handy links:

@ghost
Copy link

ghost commented Sep 28, 2021

🎉v7.2.0-preview.10 has been released which incorporates this pull request.:tada:

Handy links:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CL-General Indicates that a PR should be marked as a general cmdlet change in the Change Log

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants