-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathswf.aws.txt
556 lines (533 loc) · 35.7 KB
/
swf.aws.txt
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
┏━━━━━━━━━┓
┃ SWF ┃
┗━━━━━━━━━┛
SWF ==> #Version from 2013-12-30
GOAL ==> #Task coordination between different components (e.g. EC2 instances)
WORKFLOW (SUMMARY) ==> #Chain of actions/events using several actors (e.g. EC2 instances)
#Events:
# - Anything happening in a Workflow, e.g. Workflow|DecisionTask|Activity start|stop
# - Retrieved with:
# - PollForDecisionTask() (last events (using [previous]StartedEventId), only basic info)
# - GetWorkflowExecutionHistory() (all events, full info)
# - Kept for workflowExecutionRetentionPeriodInDays (domain attribute) (def|max: 90 days)
#High-level actions:
# - StartWorkflowExecution(), TerminateWorkflowExecution(),
# RequestCancelWorkflowExecution(), SignalWorkflowExecution()
# - done by actors "External"
#DecisionTask:
# - scheduled when any major EVENT (not minor) is fired
# - started by actors "Deciders" with PollForDecisionTask() (long polling of 60 secs)
# - assigned only once to one decider.
# - actually return all events, not only last ones (which are assigned only once to that
# decider), but can see last ones assigned with [previous]StartedEventId
# - must respond to it with RespondDecisionTaskCompleted() (including with empty
# Decisions) in order to poll again
# - must then use GetWorkflowExecutionHistory() to get details about events
# - stopped by Deciders, which return an action DECISION
# - one possible DECISION is to schedule an ActivityTask
#ActivityTask:
# - started by actors "Workers" with PollForActivityTask() (long polling of 60 secs)
# - assigned only once to one worker
# - stopped by Workers, giving feedback when finished
#In short:
# - Externals start the workflow
# - Deciders reacts to events and schedule activities accordingly
# - Workers do the actual task
IDENTIFIERS ==> # - name + version: unique ID for WorkflowType or ActivityType
# - domain: shared ID (namespace) for WorkflowType
# - workflowId + runId: unique ID for Workflow.
# - If looping with "continueAsNewWorkflowExecution", change runId but not workflowId.
# - taskList: shared ID (namespace) (def: use default ones) for:
# - DecisionTask: assigned to Workflows (of same domain) and Decider can pick which
# DecisionTask's taskList to poll from
# - ActivityTask: assigned by Decider, and Worker picks which ActivityTask's taskList to poll
# from
# - tagList: tags for Workflow, used as filters when listing them
OTHERS ==> # - WorkflowType|ActivityType:
# - to share description and default values across Workflow|Activity
# - can be thought as classes and instances
# - there are no system default, so if no default values in WorkflowType|ActivityType,
# must specify it in later actions or they will fail
# - Child workflows:
# - Launched by Deciders
# - when parent terminates, child either (childPolicy) "TERMINATE", "REQUEST_CANCEL" (Cancel)
# or "ABANDON" (do nothing)
# - passing information:
# - signals: custom event with input STR and signalName STR, performed by External or Decider
# - input STR when starting workflow: available in the EVENT
# - input STR when Decider schedules an ActivityTask: available by Worker when getting the
# ActivityTask
# - custom metadata associated with some EVENT:
# - markers (recordMarker()): custom event with only metadata (don't schedule a DecisionTask)
# - executionContext STR: with decisionTaskCompleted EVENT
# - control STR: with other EVENT
# - identity STR: with pollForDecisionTask(), should be identity of Decider
# - timer:
# - custom event fired after a delay (startToFireTimeout)
# - starting the delay fires "TimerStarted" (doesn't schedule a DecisionTask), finishing the
# delay fires "TimerFired" (schedule a DecisionTask)
# - SWF version of setTimeout()
TIMEOUTS ==> #Timeouts (def: none for all):
# - ExecutionStartToCloseTimeout: timeout between workflow start and end
# - TaskStartToCloseTimeout: timeout between activity start and end
# - TaskScheduleToStartTimeout: timeout between activity scheduled start and (event emitted)
# - TaskScheduleToCloseTimeout: timeout between activity scheduled end and scheduled
# (event emitted)
# - TaskHeartbeatTimeout: worker must fire RecordActivityTaskHeartbeat() at regular interval to
# have timeout
WORKFLOW (DETAILED) ==> #Workflow start (all below: EVENT "workflowExecutionStarted"):
# - StartWorkflowExecution()
# - DECISION "startChildWorkflowExecution":
# - child workflow (EVENT "startChildWorkflowExecutionInitiated|Failed")
# - Child workflow emits same EVENT as normal Workflow but as "childWorkflow*"
# - DECISION "continueAsNewWorkflowExecution":
# - stop current + start new one with same workflowType|Id (looping) but different runId
# (EVENT "workflowExecutionContinuedAsNew", "continueAsNewWorkflowExecutionFailed")
#Workflow stop:
# - DECISION "completeWorkflowExecution"
# - normal exit. Communicates a result STR to the EVENT.
# (EVENT "workflowExecutionCompleted", "completeWorkflowExecutionFailed")
# - TerminateWorkflowExecution() (EVENT "workflowExecutionTerminated")
# - Cancelling:
# - either by (all below: EVENT "requestCancelExternalWorkflowExecutionInitiated|Failed"):
# - a decider: DECISION "requestCancelExternalWorkflowExecution"
# (EVENT "externalWorkflowExecutionCancelRequested")
# - not a decider: RequestCancelWorkflowExecution()
# (EVENT "workflowExecutionCancelRequested")
# - decider should respond with DECISION "cancelWorkflowExecution" (so let decider choose)
# (EVENT "workflowExecutionCanceled", "cancelWorkflowExecutionFailed")
# - DECISION "failWorkflowExecution"
# (EVENT "workflowExecutionFailed", "failWorkflowExecutionFailed")
#Workflow signal:
# - either by (all below: EVENT "signalExternalWorkflowExecutionInitiated|Failed"):
# - a decider: DECISION "signalExternalWorkflowExecution"
# (EVENT "externalWorkflowExecutionSignaled"):
# - not a decider: SignalWorkflowExecution() (EVENT "workflowExecutionSignaled"):
#Decision task:
# - start schedule: when an EVENT is fired (EVENT "decisionTaskScheduled")
# - start decision task: PollForDecisionTask() (EVENT "decisionTaskStarted")
# - stop decision task: RespondDecisionTaskCompleted() (EVENT "decisionTaskTimedOut")
#Activity:
# - start schedule: DECISION "scheduleActivityTask"
# (EVENT "activityTaskScheduled", "scheduleActivityTaskFailed"):
# - pass input STR to Activity Worker
# - stop schedule: DECISION "requestCancelActivityTask"
# (EVENT "activityTaskCancelRequested|Canceled", "requestCancelActivityTaskFailed")
# - start activity: PollForActivityTask() (EVENT "activityTaskStarted")
# - stop activity:
# - worker using RespondActivityTaskCanceled|Completed|Failed()
# (EVENT "activityTaskCanceled|Completed|Failed")
# - decider using DECISION "requestCancelActivityTask" (same EVENT as above)
#Marker:
# - create: DECISION "recordMarker" (EVENT "markerRecorded", "recordMarkerFailed")
#Timer:
# - start: DECISION "startTimer"
# (EVENT "timerStarted|Fired" (different if startToFireTimeout), "startTimerFailed")
# - stop: DECISION "cancelTimer" (EVENT "timerCanceled", "cancelTimerFailed")
#Timeouts: EVENT "workflowExecutionTimedOut", "decisionTaskTimedOut", "activityTaskTimedOut"
PRICING ==> #Per month:
# - 1$/10000 Workflows (first 1000 free)
# - 0.05$/10000 Workflows opened days (first 30000 Workflows opened days free)
# - same price for retained Workflows (so should set low workflowExecutionRetentionPeriodInDays)
# - 1$/40000 ActivityTask|Signal|Timer|Marker (first 10000 free)
#Data transfer: in free, out 1$/8GB (like EC2)
#Prices varies per REGION
┌─────────┐
│ API │
└─────────┘
API ==> #Uses JSON not XML
ARN ==> # - arn:aws:swf:*:ACCOUNT_ID:/domain/ID
# - COND_KEYs:
# - swf:workflowType|activityType.name|version STR
# - swf:typeFilter.name|version STR
# - swf:[default]TaskList.name STR
# - swf:tagList.member.NUM STR
# - swf:tagFilter.tag
# - swf:name|version
CLOUDWATCH ==> #METRIC:
# - Workflow|DecisionTaskStartToCloseTime
# - DecisionTaskScheduleToStartTime: time between scheduled and started
# - DecisionTasksCompleted
# - StartedDecisionTasksTimedOutOnClose: number of DecisionTasks that timed out
# - WorkflowsCanceled|Completed|ContinuedAsNew|Failed|Terminated|TimedOut
# - ActivityTaskScheduleToClose|ScheduleToStart|StartToCloseTime
# - ActivityTasksCanceled|Completed|Failed
# - ScheduledActivityTasksTimedOutOnClose|Start:
# number of ActivityTask that timed out while cancelling or before starting
# - StartedActivityTasksTimedOutOnClose|Heartbeart:
# number of ActivityTask that timed out while stopping or during Heartbeat
#Dimensions: Domain, WorkflowTypeName|Version, ActivityTypeName|Version
LIMITS ==> # - 100 domains
# - 10000 ActivityType|WorkflowType per domain
# - 1MB/API call
# - 100000 Workflow per domain
# - Workflow max 1 year
# - 25000 events per workflow
# - 1000 child workflow per workflow
# - 1000 opened Activity per workflow
# - 1000 timers per workflow
# - input|metadata|result max 32000 chars
PAGINATION ==> # - Request parameters: nextPageToken STR, maximumPageSize NUM (def|max: 100), reverseOrder BOOL
# - Response body: nextPageToken STR
┌─────────────┐
│ METHODS │
└─────────────┘
RegisterDomain() #Same as *WorkflowTypes() except:
DeprecateDomain() # - Instead of default*:
DescribeDomain() # - workflowExecutionRetentionPeriodInDays STR
ListDomains() # - typeInfo -> domainInfo:
# - workflowType -> name STR
# - no creation|deprecationDate
# - no domain, version
# - ACT_REQ -> only name STR
RegisterWorkflowType() #Request parameters:
# - domain STR
# - name STR
# - version STR
# - description STR
# - defaultChildPolicy STR
# - defaultExecution|TaskStartToCloseTimeout STR
# - defaultTaskList STR
DeprecateWorkflowType() #Request parameters ACT_REQ:
# - domain STR
# - workflowType:
# - name STR
# - version STR
DescribeWorkflowType() #Request parameters ACT_REQ
#Response body:
# - configuration: default*
# - typeInfo WORK_TYPEINFO:
# - workflowType:
# - name STR
# - version STR
# - creation|deprecationDate DATE
# - description STR
# - status "REGISTERED|DEPRECATED"
ListWorkflowTypes() #Request parameters:
# - domain STR
# - name STR
# - registrationStatus "REGISTERED|DEPRECATED"
#Response body: typeInfos WORK_TYPEINFO_ARR
#Paginates
StartWorkflowExecution() #Request parameters STARTED_WORKFLOW:
# - workflowId STR
# - workflowType:
# - name STR
# - version STR
# - domain STR
# - taskList: name STR
# - taskStartToCloseTimeout STR
# - executionStartToCloseTimeout STR
# - childPolicy "TERMINATE|REQUEST_CANCEL|ABANDON"
# - input STR
# - tagList STR_ARR
#Response body: runId STR
TerminateWorkflowExecution() #Request parameters:
# - workflowId, runId, domain, childPolicy
# - reason STR, details STR
RequestCancelWorkflowExecution#Request parameters: workflowId, runId, domain
SignalWorkflowExecution() #Request parameters:
# - workflowId, runId, domain
# - signalName STR
# - input STR
ListOpen|Closed #Request parameters WORKFLOW:
WorkflowExecutions() # - domain STR
# - executionFilter: workflowId STR
# - start|closeTimeFilter: latest|oldestDate DATE (close: only "Closed")
# - typeFilter:
# - name STR
# - version STR
# - tagFilter: tag STR
# - closeStatusFilter: status STR (only "Closed")
#Response body: executionInfos OBJ_ARR:
# - cancelRequested BOOL
# - closeStatus STR
# - start|closeTimestamp DATE
# - execution|parent EXEC_INFO:
# - runId STR
# - workflowId STR
# - executionStatus STR
# - tagList STR_ARR
# - workflowType:
# - name STR
# - version STR
#Paginates
CountOpen|Closed #Request parameters WORKFLOW
WorkflowExecutions() #Response body:
# - count NUM
# - truncated BOOL
DescribeWorkflowExecution() #Request parameters:
# - domain STR
# - execution EXEC_INFO
#Response body:
# - executionConfiguration:
# - childPolicy STR
# - executionStartToCloseTimeout STR
# - taskList: name STR
# - taskStartToCloseTimeout STR
# - executionInfo EXEC_INFO
# - latestActivityTaskTimestamp DATE
# - latestExecutionContext STR
# - openCounts:
# - openActivityTasks NUM
# - openChildWorkflowExecutions NUM
# - openDecisionTasks NUM
# - openTimers NUM
PollForDecisionTask() #Request parameters:
# - domain STR
# - taskList: name STR
# - identity STR
#Response body:
# - events EVENT_ARR:
# - eventId NUM
# - eventTimestamp NUM
# - eventType EVENT_TYPE
# - *EventsAttributes OBJ: see GetWorkflowExecutionHistory()
# - [previous]StartedEventId NUM: range of the eventId of the events returned
# - taskToken STR: unique ID for this DECISION, to use in RespondDecisionTaskCompleted()
# - workflowExecution EXEC_INFO
# - workflowType:
# - name STR
# - version STR
#Paginates
CountPendingDecisionTasks() #Like CountPendingActivityTasks()
RespondDecisionTaskCompleted()#Request parameters:
# - taskToken STR
# - executionContext STR
# - decisions OBJ_ARR:
# - decisionType DECISION (e.g. "CancelWorkflowExecution")
# (All following actually end with *DecisionAttributes)
# - scheduleActivityTask SCHEDULE_ACTIVITY_TASK:
# - activityId STR
# - activityType:
# - name STR
# - version STR
# - taskList: name STR
# - input STR
# - control STR
# - heartbeat|scheduleToClose|scheduleToStart|startToCloseTimeout STR
# - requestCancelActivityTask: activityId STR
# - completeWorkflowExecution: result STR
# - cancelWorkflowExecution: details STR
# - requestCancelExternalWorkflowExecution:
# - control STR
# - EXEC_INFO members
# - failWorkflowExecution:
# - details STR
# - reason STR
# - continueAsNewWorkflowExecution CONTINUE_AS_NEW:
# - same members as STARTED_WORKFLOW but:
# - no domain, workflowId
# - workflowType -> workflowTypeVersion STR
# - startChildWorkflowExecution CHILD_WORKFLOW_EXECUTION:
# - same members as STARTED_WORKFLOW but no domain
# - control STR
# - signalExternalWorkflowExecution SIGNAL_WORKFLOW:
# - control STR
# - input STR
# - signalName STR
# - EXEC_INFO members
# - recordMarker MARKER:
# - details STR
# - markerName STR
# - startTimer TIMER:
# - timerId STR
# - startToFireTimeout NUM
# - control STR
# - cancelTimer: timerId STR
RegisterActivityType() #Same as *WorkflowTypes() except:
DeprecateActivityType() # - WorkflowType -> ActivityType
DescribeActivityType() # - instead of default*:
ListActivityTypes() # - defaultTaskHeartbeat|TaskStartToClose|TaskScheduleToStart|CloseTimeout STR
# - defaultTaskList: name STR
PollForActivityTask() #Request parameters:
# - domain STR
# - identity STR
# - taskList: name STR
#Response body:
# - activityId STR
# - activityType:
# - name STR
# - version STR
# - input STR
# - startedEventId NUM
# - taskToken STR
# - workflowExecution EXEC_INFO
CountPendingActivityTasks() #Request parameters:
# - domain STR
# - taskList: name STR
#Response body:
# - count NUM
# - truncated BOOL
RespondActivityTask #Request parameters:
Canceled|Completed|Failed() # - taskToken STR
# - details STR or ("Completed") --result STR
# - reason STR (only "Failed")
RecordActivityTaskHeartbeat() #Request parameters:
# - details STR
# - taskToken STR
#Response body: cancelRequested BOOL
GetWorkflowExecutionHistory() #Request parameters:
# - domain STR
# - execution EXEC_INFO
#Response body: events:
# - same members as EVENT_ARR
# - one of the following members EVENT_TYPE:
# - VAR is EVENTTYPEEventAttributes, e.g. if eventType "ActivityTaskCanceled", VAR will be
# activityTaskCanceledEventAttributes (only written as activityTaskCanceled below)
# - some recurring members:
# - decisionTaskCompletedEventId: eventId of the decisionTaskCompleted EVENT that
# triggered that EVENT
# - startedEventId: eventId of the EVENT that triggered that EVENT
# - workflowExecutionStarted:
# - same members as STARTED_WORKFLOW but: no workflowId nor domain
# - continuedExecutionRunId STR
# - parentInitiatedEventId NUM
# - parentWorkflowExecution EXEC_INFO
# - signal|requestCancelExternalWorkflowExecutionInitiated
# - decisionTaskCompletedEventId NUM
# - same members as SIGNAL_WORKFLOW except no input nor signalName if "signal"
# - signal|requestCancelExternalWorkflowExecutionFailed:
# - decisionTaskCompletedEventId NUM
# - cause STR
# - control STR
# - initiatedEventId NUM
# - EXEC_INFO members
# - [external]WorkflowExecutionSignaled:
# - [external]InitiatedEventId NUM
# - [external]WorkflowExecution EXEC_INFO
# - input STR (if no "external")
# - signalName STR (if no "external")
# - workflowExecutionCompleted:
# - decisionTaskCompletedEventId NUM
# - result STR
# - workflowExecutionFailed:
# - decisionTaskCompletedEventId NUM
# - details STR
# - reason
# - complete|cancel|continueAsNew|failWorkflowExecutionFailed:
# - cause STR
# - decisionTaskCompletedEventId NUM
# - workflowExecutionTimedOut:
# - childPolicy STR
# - timeoutType "START_TO_CLOSE"
# - workflowExecutionContinuedAsNew:
# - decisionTaskCompletedEventId NUM
# - same as CONTINUE_AS_NEW but:
# - newExecutionRunId STR
# - workflowTypeVersion -> workflowType: name STR, version STR
# - workflowExecutionTerminated:
# - cause STR
# - childPolicy STR
# - details STR
# - reason STR
# - [external]WorkflowExecutionCancelRequested:
# - cause STR (if no "external")
# - [external]InitiatedEventId NUM ("external" if no "external", not the other way around)
# - [external]WorkflowExecution EXEC_INFO
# - workflowExecutionCanceled:
# - decisionTaskCompletedEventId NUM
# - details STR
# - childWorflow*: like workflow* but:
# - not for workflowExecutionSignaled nor workflowExecutionContinuedAsNew
# - has extra members:
# - initiatedEventId NUM
# - startedEventId NUM
# - workflowExecution EXEC_INFO
# - workflowType:
# - name STR
# - version STR
# - does not have members decisionTaskCompletedEventId, childPolicy
# - workflowExecutionStarted -> does not have any of its members
# - startChildWorkflowExecutionInitiated:
# - decisionTaskCompletedEventId NUM
# - same members as CHILD_WORKFLOW_EXECUTION
# - startChildWorkflowExecutionFailed:
# - decisionTaskCompletedEventId NUM
# - cause STR
# - control STR
# - initiatedEventId NUM
# - workflowId STR
# - workflowType:
# - name STR
# - version STR
# - activityTaskScheduled:
# - decisionTaskCompletedEventId NUM
# - same members as SCHEDULE_ACTIVITY_TASK
# - scheduleActivityTaskFailed:
# - decisionTaskCompletedEventId NUM
# - activityId STR
# - activityType:
# - name STR
# - version STR
# - cause STR
# - activityTaskStarted:
# - scheduledEventId NUM
# - identity STR
# - activityTaskCancelRequested:
# - decisionTaskCompletedEventId NUM
# - activityId STR
# - activityTaskCanceled:
# - scheduledEventId NUM
# - startedEventId NUM
# - latestCancelRequestedEventId NUM
# - details STR
# - activityTaskCompleted:
# - scheduledEventId NUM
# - startedEventId NUM
# - result STR
# - activityTaskFailed:
# - scheduledEventId NUM
# - startedEventId NUM
# - details STR
# - reason STR
# - requestCancelActivityTaskFailed:
# - decisionTaskCompletedEventId NUM
# - activityId STR
# - cause STR
# - activityTaskTimedOut:
# - scheduledEventId NUM
# - startedEventId NUM
# - details STR
# - timeoutType "START_TO_CLOSE|SCHEDULE_TO_START|SCHEDULE_TO_CLOSE|HEARTBEAT"
# - decisionTaskScheduled:
# - startToCloseTimeout STR
# - taskList: name STR
# - decisionTaskStarted:
# - scheduledEventId NUM
# - identity STR
# - decisionTaskCompleted:
# - scheduledEventId NUM
# - startedEventId NUM
# - executionContext STR
# - decisionTaskTimedOut:
# - scheduledEventId NUM
# - startedEventId NUM
# - timeoutType "START_TO_CLOSE"
# - markerRecorded:
# - decisionTaskCompletedEventId NUM
# - details STR
# - markerName STR
# - recordMarkerFailed:
# - decisionTaskCompletedEventId NUM
# - cause STR
# - markerName STR
# - timerFired:
# - startedEventId NUM
# - timerId STR
# - timerStarted:
# - decisionTaskCompletedEventId NUM
# - same members as TIMER
# - startTimerFailed:
# - decisionTaskCompletedEventId NUM
# - cause STR
# - timerId STR
# - timerCanceled:
# - decisionTaskCompletedEventId NUM
# - startedEventId NUM
# - timerId STR
# - cancelTimerFailed:
# - decisionTaskCompletedEventId NUM
# - cause STR
# - timerId STR
#Paginates