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
<details> with:with:
<pre><code> Construct a new 2-stage pipeline
Arguments:
anOsProcessStarter1 - <OsProcessStarter>
anOsProcessStarter2 - <OsProcessStarter>
Answers:
<OsPipelineStarter>
</code></pre> </details>
<details> with:with:with:
<pre><code> Construct a new 2-stage pipeline
Arguments:
anOsProcessStarter1 - <OsProcessStarter>
anOsProcessStarter2 - <OsProcessStarter>
anOsProcessStarter3 - <OsProcessStarter>
Answers:
<OsPipelineStarter>
</code></pre> </details>
<details> with:with:with:with:
<pre><code> Construct a new 2-stage pipeline
Arguments:
anOsProcessStarter1 - <OsProcessStarter>
anOsProcessStarter2 - <OsProcessStarter>
anOsProcessStarter3 - <OsProcessStarter>
anOsProcessStarter4 - <OsProcessStarter>
Answers:
<OsPipelineStarter>
</code></pre> </details>
<details> with:withAll:
<pre><code> Construct a new 2-stage pipeline
Arguments:
anOsProcessStarter1 - <OsProcessStarter>
someOsProcessStarters - <SequenceableCollection> of <OsProcessStarter>
Answers:
<OsPipelineStarter>
</code></pre> </details>
<details> withAll:
<pre><code> Construct a new 2-stage pipeline
Arguments:
aCollectionOfProcessStarters - <Array> with <OsProcessStarter>
Answers:
<OsPipelineStarter>
</code></pre> </details>
Instance Methods
<details> &&
<pre><code> 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>
</code></pre> </details>
<details> =>
<pre><code> Answer a sequence pipeline chain. aSequenceableStarter will start as soon as this pipeline starter finishes
Arguments:
aSequenceableStarter - <OsProcessStarter | OsPipelineStarter | OsPipelineChainStarter>
Answers:
<OsPipelineChainStarter>
</code></pre> </details>
<details> |
<pre><code> 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>
</code></pre> </details>
<details> ||
<pre><code> 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>
</code></pre> </details>
<details> inheritError
<pre><code> Direct each process to Inherit error of the last processes starter from the parent VAST process stdout
Answers:
<OsPipelineStarter>
</code></pre> </details>
<details> inheritInput
<pre><code> Inherit output of the first processes starter from the parent VAST process stdout
Answers:
<OsPipelineStarter>
</code></pre> </details>
<details> inheritOutput
<pre><code> Inherit output of the last processes starter from the parent VAST process stdout
Answers:
<OsPipelineStarter>
</code></pre> </details>
<details> pipelineClass
<pre><code> Answer the implementation class for an os process pipeline
Answers:
<Object>
</code></pre> </details>
<details> pipelineClass:
<pre><code> Set the implementation class for an os process pipeline
Arguments:
aPipelineClass - <Object>
</code></pre> </details>
<details> redirectErrorToFile:
<pre><code> 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>
</code></pre> </details>
<details> redirectErrorToOutput
<pre><code> Direct each process starter to merge errors with the output so
they are both redirected to the same location.
Answers:
<OsPipelineStarter>
</code></pre> </details>
<details> redirectInputToFile:
<pre><code> Redirect input of the first processes starter to the @aFilenameOrPath.
Arguments:
aFilenameOrPath - <String> or <CfsPath> file on the filesysystem
Answers:
<OsPipelineStarter>
</code></pre> </details>
<details> redirectInputToNull
<pre><code> Redirect input of the first processes starter to the OS-specific null bucket. Do this to ignore input
Answers:
<OsPipelineStarter>
</code></pre> </details>
<details> redirectInputToPipe
<pre><code> Redirect input of the first process starter to a pipe. Use OsVastSubprocess>>outputStream to access
Answers:
<OsPipelineStarter>
</code></pre> </details>
<details> redirectOutputToFile:
<pre><code> 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>
</code></pre> </details>
<details> redirectOutputToFile:append:
<pre><code> 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>
</code></pre> </details>
<details> redirectOutputToNull
<pre><code> Redirect output of the last processes starter to the OS-specific null bucket. Do this to ignore output
Answers:
<OsPipelineStarter>
</code></pre> </details>
<details> redirectOutputToPipe
<pre><code> Redirect output of the last processes starter to a pipe. Use OsPipeline>>outputStream to access
Answers:
<OsPipelineStarter>
</code></pre> </details>
<details> start
<pre><code> 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>
</code></pre> </details>