Skip to content

Latest commit

 

History

History
76 lines (62 loc) · 4.23 KB

02-task_definition.md

File metadata and controls

76 lines (62 loc) · 4.23 KB

Task Definition

YAML Configuration

<task_name>:                       # name of the task in the process, used in the outputs
    task: <code of the task>
    description: <string>
    help: <multiline string>
    options: <task options>
    outputs: <list of following task codes>
    error_outputs: <list of following task codes>
    branches: <list of following task codes, by branch name>
    error_strategy: <skip|stop>
    log_level: <emergency|alert|critical|error|warning|notice|info|debug>

Task attributes

task: required, code of the task, e.g. task: transformer. The code of each task of this bundle is given on its reference page (e.g. transformer for the TransformerTask); the code of a task service is declared with a cleverage.task tag with a code attribute, or with the #[CleverAge\ProcessBundle\Attribute\AsTask(code: '...')] attribute (see custom tasks). A code is unique: it identifies a single task service in the application (the tasks of this bundle have unprefixed codes, use a prefix for the ones of your own tasks), two services with the same code fail the container compilation. The codes are resolved when the container is compiled: an unknown code fails the compilation, with the list of the known codes. The services of the tasks referenced by the process configurations are collected when the container is compiled, so they can be private. A task of a configuration unknown when the container is compiled (e.g. added at runtime) is not found.

The service attribute (reference to the service of the task instead of its code), deprecated since 5.4, is removed in v6.0: use task.

description: optional string to describe a task, displayed in process help (should not exceed one line).

help: optional string to describe in depth a task (can be multiline).

options: optional list of parameters to pass to the task. String values can contain {{ key }} placeholders that are replaced by the process contextual values.

outputs: optional list of following tasks, receiving the output of this task. It can be a simple string. A task listed several times throws an InvalidProcessConfigurationException when the process is resolved (also for error_outputs): list it once. Each listed task must be a task of the same process (see invalid task references).

error_outputs: optional list of following tasks, receiving the error output of this task (by default its input when an error occurs). It can be a simple string. See errors and skips.

branches: optional lists of following tasks, by branch name, receiving the output of this task only when it selects their branch (ProcessState::setOutputBranch()), in addition to its outputs. A branch can be a simple string or an empty list. A task listed several times in the outputs and branches of a task throws an InvalidProcessConfigurationException when the process is resolved; each listed task must be a task of the same process. The tasks of a branch are in the main branch (not in an error branch). See conditional branches.

route:
    task: app_route_by_type     # calls $state->setOutputBranch('product') or setOutputBranch('category')
    outputs: [log]              # receives every output
    branches:
        product: [write_product]
        category: [write_category, notify]

error_strategy: optional, either skip or stop. Defines if the process continues with the next input or stops when the task fails. When not defined, the global default_error_strategy is used (stop by default). Another value fails the container compilation; a value given by an environment variable is only checked when the task fails (the process fails with "Unknown error strategy").

log_level: optional RFC 5424 severity (emergency, alert, critical, error, warning, notice, info, debug) of the log record written on the cleverage_process_task channel when the task fails. Default is critical.