OsPipelineStarter
Description
Instances of this class are used to help configure and start pipelines.
A pipeline is a sequenceable collection of vast subprocesses wired together such that the output of one flows into the input of the next. This allows for a 'pipeline' style of concurrency, and the pipeline object is designed to be polymorphic with an <OsVastSubprocess>.
Users typically won't directly instantiate an OsPipelineStarter, but instead they can use the message | on <OsProcessStarter>, <OsPipelineStarter> and other <OsPipelineChainStarter> instances.
Examples
The following are some examples on Windows that show how the logic works. Copy this to a workspace
"Example - Pipeline"
| starter pipeline str findItemCmd sortCmd |
 
'sortme.txt' asPath writeStreamDo: [:stream | stream nextPutAll: 'ITEM zz'; cr; nextPutAll: 'ITEM bb'; cr; nextPutAll: 'ITEM aa'].
 
findItemCmd := OsProcessStarter command: #('find' '"ITEM"' 'sortme.txt').
sortCmd := OsProcessStarter command: #('sort').
 
"Create and start a pipeline"
starter := findItemCmd | sortCmd.
pipeline := starter start.
pipeline waitForCompletion.
 
"Get output from the pipeline"
str := pipeline outputStream upToEnd trimSeparators.
Class Methods
with:with:
  Construct a new 2-stage pipeline

     Arguments: 
        anOsProcessStarter1 - <OsProcessStarter>
        anOsProcessStarter2 - <OsProcessStarter>
     Answers:   
        <OsPipelineStarter>
with:with:with:
  Construct a new 2-stage pipeline

     Arguments: 
        anOsProcessStarter1 - <OsProcessStarter>
        anOsProcessStarter2 - <OsProcessStarter>
        anOsProcessStarter3 - <OsProcessStarter>
     Answers:   
        <OsPipelineStarter>
with:with:with:with:
  Construct a new 2-stage pipeline

     Arguments: 
        anOsProcessStarter1 - <OsProcessStarter>
        anOsProcessStarter2 - <OsProcessStarter>
        anOsProcessStarter3 - <OsProcessStarter>
        anOsProcessStarter4 - <OsProcessStarter>
     Answers:   
        <OsPipelineStarter>
with:withAll:
  Construct a new 2-stage pipeline

     Arguments: 
        anOsProcessStarter1 - <OsProcessStarter>
        someOsProcessStarters - <SequenceableCollection> of <OsProcessStarter>
     Answers:   
        <OsPipelineStarter>
withAll:
  Construct a new 2-stage pipeline

     Arguments: 
        aCollectionOfProcessStarters - <Array> with <OsProcessStarter>
     Answers:   
        <OsPipelineStarter>
Instance Methods
&&
  Answer a conditional sequence pipeline chain.
     aSequenceableStarter will start as soon as this pipeline starter finishes
     IF the exit code from this pipeline is considered success (by default, an exitcode of 0)

     Arguments: 
        aSequenceableStarter - <OsProcessStarter | OsPipelineStarter | OsPipelineChainStarter>
     Answers:   
        <OsPipelineChainStarter>
=>
  Answer a sequence pipeline chain.
     aSequenceableStarter will start as soon as this pipeline starter finishes

     Arguments: 
        aSequenceableStarter - <OsProcessStarter | OsPipelineStarter | OsPipelineChainStarter>
     Answers:   
        <OsPipelineChainStarter>
|
  Answer a pipeline, or pipeline chain, that is configured to feed the output from this
     starter into the input of @aPipelineableStarter.
     The execution of this pipeline will perform the starters in parallel

     Arguments: 
        aPipelineableStarter - <OsProcessStarter | OsPipelineStarter | OsPipelineChainStarter>
     Answers:   
        <OsProcessStarter | OsPipelineStarter | OsPipelineChainStarter>
||
  Answer a conditional sequence pipeline.
     aSequenceableStarter will start as soon as this pipeline starter finishes
     IF the exit code from this pipeline is considered a failure code (by default, an exitcode ~= 0)

     Arguments: 
        aSequenceableStarter - <OsProcessStarter | OsPipelineStarter | OsPipelineChainStarter>
     Answers:   
        <OsPipelineChainStarter>
inheritError
  Direct each process to Inherit error of the last processes starter from
     the parent VAST process stdout

     Answers:
        <OsPipelineStarter>
inheritInput
  Inherit output of the first processes starter from
     the parent VAST process stdout

     Answers:
        <OsPipelineStarter>
inheritOutput
  Inherit output of the last processes starter from
     the parent VAST process stdout

     Answers:
        <OsPipelineStarter>
pipelineClass
  Answer the implementation class for
     an os process pipeline

     Answers:   
        <Object>
pipelineClass:
  Set the implementation class for
     an os process pipeline

     Arguments: 
        aPipelineClass - <Object>
redirectErrorToFile:
  Direct each process to redirect errors to @aFilenameOrPath.
     The file will be opened in atomic append mode

     Arguments:
        aFilenameOrPath - <String> or <CfsPath> file on the filesysystem
     Answers:
        <OsProcessStarter>
redirectErrorToOutput
  Direct each process starter to merge errors with the output so  
     they are both redirected to the same location.

     Answers:
        <OsPipelineStarter>
redirectInputToFile:
  Redirect input of the first processes starter to the @aFilenameOrPath.

     Arguments:
        aFilenameOrPath - <String> or <CfsPath> file on the filesysystem
     Answers:
        <OsPipelineStarter>
redirectInputToNull
  Redirect input of the first processes starter to the
     OS-specific null bucket.
     Do this to ignore input

     Answers:
        <OsPipelineStarter>
redirectInputToPipe
  Redirect input of the first process starter to a pipe.
     Use OsVastSubprocess>>outputStream to access

     Answers:
        <OsPipelineStarter>
redirectOutputToFile:
  Redirect output of the last processes starter to the @aFilenameOrPath.
     The file will be created or truncated if it exists

     Arguments:
        aFilenameOrPath - <String> or <CfsPath> file on the filesysystem
     Answers:
        <OsPipelineStarter>
redirectOutputToFile:append:
  Redirect ouptut to @aFilenameOrPath.

     If append is true
        The file will be opened in atomic append mode
     If append is false
        The file will be created or truncated if it exists
        and opened for writing

    Answers:
        <OsPipelineStarter>
redirectOutputToNull
  Redirect output of the last processes starter to the
     OS-specific null bucket.
     Do this to ignore output

     Answers:
        <OsPipelineStarter>
redirectOutputToPipe
  Redirect output of the last processes starter to a pipe.
     Use OsPipeline>>outputStream to access

     Answers:
        <OsPipelineStarter>
start
  Starts and answers a new pipeline of processes.
     Arrange stdio such that the output of process n
     is piped into the input of process n+1.
     If an exception occurs, wait for all processes to be
     killed and re-signal the exception

     Answers:
        <OsPipeline>
     Raises:
        <OsProcessException>
Last modified date: 07/07/2022