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 - Code:
counter(task: counter) - 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, a positive integer, see notes) |
- Count 9 iterated items, outputting
3,6and9; withflush_every: 4it would output4,8, then9on flush
# Task configuration level
entry:
task: constant_iterable_output
options:
output: [1, 2, 3, 4, 5, 6, 7, 8, 9]
outputs: [counter]
counter:
task: counter
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.flush_every: 0is rejected when the options are resolved (InvalidOptionsException) since 5.10: it failed on the first execution (Modulo by zero). A negative value works as its absolute value (-3as3): it is deprecated since 5.10 and will be rejected in v6.0.