Counts the number of times the task is executed and only outputs the current count every flush_every executions
(the task is skipped the rest of the time). When flushed (at the end of the upstream iteration), it outputs the
final count, unless this count is a multiple of flush_every (in which case it has already been sent).
- Service:
CleverAge\ProcessBundle\Task\CounterTask - Flushable task
Input is ignored (only the number of executions matters)
int: the number of times the task has been executed so far
| Code | Type | Required | Default | Description |
|---|---|---|---|---|
flush_every |
int |
X | Output the count every N executions (N = this option) |
- Count 9 iterated items, outputting
3,6and9; withflush_every: 4it would output4,8, then9on flush
# Task configuration level
entry:
service: '@CleverAge\ProcessBundle\Task\ConstantIterableOutputTask'
options:
output: [1, 2, 3, 4, 5, 6, 7, 8, 9]
outputs: [counter]
counter:
service: '@CleverAge\ProcessBundle\Task\CounterTask'
options:
flush_every: 3
outputs: [debug]flush()can be called several times during a process (see Advanced workflow), e.g. once at the end of the upstream iteration and once when the counter itself is resolved. The final count is only outputted by the first call; the next ones are skipped.