Pipeline Streaming Module

Welcome Forums General PowerShell Q&A Pipeline Streaming Module

This topic contains 1 reply, has 2 voices, and was last updated by

 
Keymaster
1 year, 6 months ago.

  • Author
    Posts
  • #70799

    Participant
    Points: 0
    Rank: Member

    Hi, I'm giving a PowerShell class and one of the students asked a question related to the modes of processing data within a powershell pipeline (streaming vs. sequential mode)

    Given a typical pipeline like:

    Get-ChildItem | Sort-Object Length | Select-Object Length, Name | ForEach { ... }

    Will Sort-Object switch the entire pipeline to sequential processing meaning that all pipeline commands are executed one at a time

    ... or ...

    Will only Sort-Object hand over its entire (sorted) results to the next command while the rest of the pipeline remains in streaming mode or rather real-time processing.

    Thanks

  • #70802

    Keymaster
    Points: 1,625
    Helping HandTeam Member
    Rank: Community Hero

    There's no way to "switch" the pipeline. Sort merely declines to emit anything until it's gotten the all-clear that nothing more is coming. It then emits its results on object at a time, and they continue to stream down the pipeline in that fashion unless someone else "blocks."

    There is no "mode" for the pipeline.

The topic ‘Pipeline Streaming Module’ is closed to new replies.