Skip to content

Wait-RSJob and Receive-RSJob pipeline streaming #26

@Ashnal

Description

@Ashnal

Is there currently a way to output Jobs as they complete from the pipeline?

Currently, if you run code like this:
1..100 | Start-RSJob -Throttle 25 {Start-sleep -seconds 2; $_} | Wait-RSJob -ShowProgress | Receive-RSJob

You will see the progress track, but no output is produced until all jobs complete. Would it be possible for Wait-RSJob to output jobs as they complete, rather than all at once?

Receive-RSJob has this same problem. It collects all pipeline input during process and waits to spit it all out in the end block. I'd much rather see it output Jobs during the process block.

This is incredibly important when there is a chance of a job hanging. Some WMI calls can hang in a pretty bad way, and allowing streaming output means that any jobs that finished (usually all but one) can have their output written via Export-csv or similar, even if one hangs.

Is there a way to submit a fix for this? I ended up writing a working fix for both Wait-RSJob and Receive-RSJob before I pressed the submit button.

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions