-
-
Notifications
You must be signed in to change notification settings - Fork 28
Expand file tree
/
Copy pathworkflow.yaml
More file actions
51 lines (51 loc) · 1.36 KB
/
Copy pathworkflow.yaml
File metadata and controls
51 lines (51 loc) · 1.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
document:
dsl: 1.0.0
taskQueue: zigflow
workflowType: batch-processing
version: 0.0.1
title: Batch Processing
summary: Iterate over a collection, call a service per item, and collect the results
metadata:
tags:
- for-loop
- batch
activityOptions:
startToCloseTimeout:
minutes: 1
input:
schema:
format: json
document:
type: object
required:
- userIds
properties:
userIds:
type: array
items:
type: number
do:
# Process each item in turn. A `for` task over an array returns an array of
# each iteration's result, so collecting the batch is just reading `.` from
# the loop with `output.as` - no manual accumulation needed.
- processBatch:
output:
as:
count: ${ . | length }
results: ${ . }
for:
# The current item is $data.user; its position is $data.index.
each: user
in: ${ $input.userIds }
at: index
do:
- fetchUser:
call: http
# This iteration's result. The loop aggregates these into an array.
output:
as:
userId: ${ $data.user }
name: ${ .name }
with:
method: get
endpoint: ${ "https://jsonplaceholder.typicode.com/users/" + ($data.user | tostring) }