Stops the process on purpose: this is not a failure, but a decision of the process, e.g. not going on when the source file does not exist. Unlike DieTask, the stop is handled by the process manager:
- the stop signal goes back up to the root task: no following task is executed, including remaining iterations (other root tasks are still executed, see advanced workflow);
- every task is finalized (e.g. a writer closes its file);
- the process ends as stopped: its history is flagged as stopped (
ProcessHistory::isStopped()), theProcess <process_code> stoppedlog is written (at thesuccess_level, see process definition), and thecleverage_process.endevent is dispatched withProcessEvent::isProcessStopped()returningtrue(the UI shows the execution as Stopped); cleverage:process:executeexits with code 0, and the task running a sub-process (ProcessExecutorTask) goes on.
A process that has already failed (e.g. a task whose initialization failed, see the
initializable tasks) stays failed: the StopTask still stops the flow of the
tasks, but it does not turn the failure into a stop.
To stop a process because of an error, let the error fail the process instead (error strategy stop).
- Service:
CleverAge\ProcessBundle\Task\StopTask - Code:
stop(task: stop)
Input is ignored
None, the process is stopped
This task has no option.
- Do not go on when the source file does not exist (
-c source:"'path/to/file.csv'")
# Task configuration level
source_path:
task: constant_output
options:
output: '{{ source }}'
outputs: [source_exists]
source_exists:
task: transformer
options:
transformers:
callback:
callback: file_exists
outputs: [check_source]
check_source:
task: filter
options:
match:
'': true
outputs: [read]
error_outputs: [stop]
stop:
task: stop
read:
task: csv_reader
options:
file_path: '{{ source }}'- Stop the process on the first invalid item
# Task configuration level
validate:
task: validator
error_strategy: skip
error_outputs: [abort]
abort:
task: stop