Mercurial > repos > guerler > springsuite
comparison planemo/lib/python3.7/site-packages/boto/swf/layer1_decisions.py @ 0:d30785e31577 draft
"planemo upload commit 6eee67778febed82ddd413c3ca40b3183a3898f1"
author | guerler |
---|---|
date | Fri, 31 Jul 2020 00:18:57 -0400 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:d30785e31577 |
---|---|
1 """ | |
2 Helper class for creating decision responses. | |
3 """ | |
4 | |
5 | |
6 class Layer1Decisions(object): | |
7 """ | |
8 Use this object to build a list of decisions for a decision response. | |
9 Each method call will add append a new decision. Retrieve the list | |
10 of decisions from the _data attribute. | |
11 | |
12 """ | |
13 def __init__(self): | |
14 self._data = [] | |
15 | |
16 def schedule_activity_task(self, | |
17 activity_id, | |
18 activity_type_name, | |
19 activity_type_version, | |
20 task_list=None, | |
21 control=None, | |
22 heartbeat_timeout=None, | |
23 schedule_to_close_timeout=None, | |
24 schedule_to_start_timeout=None, | |
25 start_to_close_timeout=None, | |
26 input=None): | |
27 """ | |
28 Schedules an activity task. | |
29 | |
30 :type activity_id: string | |
31 :param activity_id: The activityId of the type of the activity | |
32 being scheduled. | |
33 | |
34 :type activity_type_name: string | |
35 :param activity_type_name: The name of the type of the activity | |
36 being scheduled. | |
37 | |
38 :type activity_type_version: string | |
39 :param activity_type_version: The version of the type of the | |
40 activity being scheduled. | |
41 | |
42 :type task_list: string | |
43 :param task_list: If set, specifies the name of the task list in | |
44 which to schedule the activity task. If not specified, the | |
45 defaultTaskList registered with the activity type will be used. | |
46 Note: a task list for this activity task must be specified either | |
47 as a default for the activity type or through this field. If | |
48 neither this field is set nor a default task list was specified | |
49 at registration time then a fault will be returned. | |
50 """ | |
51 o = {} | |
52 o['decisionType'] = 'ScheduleActivityTask' | |
53 attrs = o['scheduleActivityTaskDecisionAttributes'] = {} | |
54 attrs['activityId'] = activity_id | |
55 attrs['activityType'] = { | |
56 'name': activity_type_name, | |
57 'version': activity_type_version, | |
58 } | |
59 if task_list is not None: | |
60 attrs['taskList'] = {'name': task_list} | |
61 if control is not None: | |
62 attrs['control'] = control | |
63 if heartbeat_timeout is not None: | |
64 attrs['heartbeatTimeout'] = heartbeat_timeout | |
65 if schedule_to_close_timeout is not None: | |
66 attrs['scheduleToCloseTimeout'] = schedule_to_close_timeout | |
67 if schedule_to_start_timeout is not None: | |
68 attrs['scheduleToStartTimeout'] = schedule_to_start_timeout | |
69 if start_to_close_timeout is not None: | |
70 attrs['startToCloseTimeout'] = start_to_close_timeout | |
71 if input is not None: | |
72 attrs['input'] = input | |
73 self._data.append(o) | |
74 | |
75 def request_cancel_activity_task(self, activity_id): | |
76 """ | |
77 Attempts to cancel a previously scheduled activity task. If | |
78 the activity task was scheduled but has not been assigned to a | |
79 worker, then it will be canceled. If the activity task was | |
80 already assigned to a worker, then the worker will be informed | |
81 that cancellation has been requested in the response to | |
82 RecordActivityTaskHeartbeat. | |
83 """ | |
84 o = {} | |
85 o['decisionType'] = 'RequestCancelActivityTask' | |
86 attrs = o['requestCancelActivityTaskDecisionAttributes'] = {} | |
87 attrs['activityId'] = activity_id | |
88 self._data.append(o) | |
89 | |
90 def record_marker(self, marker_name, details=None): | |
91 """ | |
92 Records a MarkerRecorded event in the history. Markers can be | |
93 used for adding custom information in the history for instance | |
94 to let deciders know that they do not need to look at the | |
95 history beyond the marker event. | |
96 """ | |
97 o = {} | |
98 o['decisionType'] = 'RecordMarker' | |
99 attrs = o['recordMarkerDecisionAttributes'] = {} | |
100 attrs['markerName'] = marker_name | |
101 if details is not None: | |
102 attrs['details'] = details | |
103 self._data.append(o) | |
104 | |
105 def complete_workflow_execution(self, result=None): | |
106 """ | |
107 Closes the workflow execution and records a WorkflowExecutionCompleted | |
108 event in the history | |
109 """ | |
110 o = {} | |
111 o['decisionType'] = 'CompleteWorkflowExecution' | |
112 attrs = o['completeWorkflowExecutionDecisionAttributes'] = {} | |
113 if result is not None: | |
114 attrs['result'] = result | |
115 self._data.append(o) | |
116 | |
117 def fail_workflow_execution(self, reason=None, details=None): | |
118 """ | |
119 Closes the workflow execution and records a | |
120 WorkflowExecutionFailed event in the history. | |
121 """ | |
122 o = {} | |
123 o['decisionType'] = 'FailWorkflowExecution' | |
124 attrs = o['failWorkflowExecutionDecisionAttributes'] = {} | |
125 if reason is not None: | |
126 attrs['reason'] = reason | |
127 if details is not None: | |
128 attrs['details'] = details | |
129 self._data.append(o) | |
130 | |
131 def cancel_workflow_executions(self, details=None): | |
132 """ | |
133 Closes the workflow execution and records a WorkflowExecutionCanceled | |
134 event in the history. | |
135 """ | |
136 o = {} | |
137 o['decisionType'] = 'CancelWorkflowExecution' | |
138 attrs = o['cancelWorkflowExecutionsDecisionAttributes'] = {} | |
139 if details is not None: | |
140 attrs['details'] = details | |
141 self._data.append(o) | |
142 | |
143 def continue_as_new_workflow_execution(self, | |
144 child_policy=None, | |
145 execution_start_to_close_timeout=None, | |
146 input=None, | |
147 tag_list=None, | |
148 task_list=None, | |
149 start_to_close_timeout=None, | |
150 workflow_type_version=None): | |
151 """ | |
152 Closes the workflow execution and starts a new workflow execution of | |
153 the same type using the same workflow id and a unique run Id. A | |
154 WorkflowExecutionContinuedAsNew event is recorded in the history. | |
155 """ | |
156 o = {} | |
157 o['decisionType'] = 'ContinueAsNewWorkflowExecution' | |
158 attrs = o['continueAsNewWorkflowExecutionDecisionAttributes'] = {} | |
159 if child_policy is not None: | |
160 attrs['childPolicy'] = child_policy | |
161 if execution_start_to_close_timeout is not None: | |
162 attrs['executionStartToCloseTimeout'] = execution_start_to_close_timeout | |
163 if input is not None: | |
164 attrs['input'] = input | |
165 if tag_list is not None: | |
166 attrs['tagList'] = tag_list | |
167 if task_list is not None: | |
168 attrs['taskList'] = {'name': task_list} | |
169 if start_to_close_timeout is not None: | |
170 attrs['taskStartToCloseTimeout'] = start_to_close_timeout | |
171 if workflow_type_version is not None: | |
172 attrs['workflowTypeVersion'] = workflow_type_version | |
173 self._data.append(o) | |
174 | |
175 def start_timer(self, | |
176 start_to_fire_timeout, | |
177 timer_id, | |
178 control=None): | |
179 """ | |
180 Starts a timer for this workflow execution and records a TimerStarted | |
181 event in the history. This timer will fire after the specified delay | |
182 and record a TimerFired event. | |
183 """ | |
184 o = {} | |
185 o['decisionType'] = 'StartTimer' | |
186 attrs = o['startTimerDecisionAttributes'] = {} | |
187 attrs['startToFireTimeout'] = start_to_fire_timeout | |
188 attrs['timerId'] = timer_id | |
189 if control is not None: | |
190 attrs['control'] = control | |
191 self._data.append(o) | |
192 | |
193 def cancel_timer(self, timer_id): | |
194 """ | |
195 Cancels a previously started timer and records a TimerCanceled | |
196 event in the history. | |
197 """ | |
198 o = {} | |
199 o['decisionType'] = 'CancelTimer' | |
200 attrs = o['cancelTimerDecisionAttributes'] = {} | |
201 attrs['timerId'] = timer_id | |
202 self._data.append(o) | |
203 | |
204 def signal_external_workflow_execution(self, | |
205 workflow_id, | |
206 signal_name, | |
207 run_id=None, | |
208 control=None, | |
209 input=None): | |
210 """ | |
211 Requests a signal to be delivered to the specified external workflow | |
212 execution and records a SignalExternalWorkflowExecutionInitiated | |
213 event in the history. | |
214 """ | |
215 o = {} | |
216 o['decisionType'] = 'SignalExternalWorkflowExecution' | |
217 attrs = o['signalExternalWorkflowExecutionDecisionAttributes'] = {} | |
218 attrs['workflowId'] = workflow_id | |
219 attrs['signalName'] = signal_name | |
220 if run_id is not None: | |
221 attrs['runId'] = run_id | |
222 if control is not None: | |
223 attrs['control'] = control | |
224 if input is not None: | |
225 attrs['input'] = input | |
226 self._data.append(o) | |
227 | |
228 def request_cancel_external_workflow_execution(self, | |
229 workflow_id, | |
230 control=None, | |
231 run_id=None): | |
232 """ | |
233 Requests that a request be made to cancel the specified | |
234 external workflow execution and records a | |
235 RequestCancelExternalWorkflowExecutionInitiated event in the | |
236 history. | |
237 """ | |
238 o = {} | |
239 o['decisionType'] = 'RequestCancelExternalWorkflowExecution' | |
240 attrs = o['requestCancelExternalWorkflowExecutionDecisionAttributes'] = {} | |
241 attrs['workflowId'] = workflow_id | |
242 if control is not None: | |
243 attrs['control'] = control | |
244 if run_id is not None: | |
245 attrs['runId'] = run_id | |
246 self._data.append(o) | |
247 | |
248 def start_child_workflow_execution(self, | |
249 workflow_type_name, | |
250 workflow_type_version, | |
251 workflow_id, | |
252 child_policy=None, | |
253 control=None, | |
254 execution_start_to_close_timeout=None, | |
255 input=None, | |
256 tag_list=None, | |
257 task_list=None, | |
258 task_start_to_close_timeout=None): | |
259 """ | |
260 Requests that a child workflow execution be started and | |
261 records a StartChildWorkflowExecutionInitiated event in the | |
262 history. The child workflow execution is a separate workflow | |
263 execution with its own history. | |
264 """ | |
265 o = {} | |
266 o['decisionType'] = 'StartChildWorkflowExecution' | |
267 attrs = o['startChildWorkflowExecutionDecisionAttributes'] = {} | |
268 attrs['workflowType'] = { | |
269 'name': workflow_type_name, | |
270 'version': workflow_type_version, | |
271 } | |
272 attrs['workflowId'] = workflow_id | |
273 if child_policy is not None: | |
274 attrs['childPolicy'] = child_policy | |
275 if control is not None: | |
276 attrs['control'] = control | |
277 if execution_start_to_close_timeout is not None: | |
278 attrs['executionStartToCloseTimeout'] = execution_start_to_close_timeout | |
279 if input is not None: | |
280 attrs['input'] = input | |
281 if tag_list is not None: | |
282 attrs['tagList'] = tag_list | |
283 if task_list is not None: | |
284 attrs['taskList'] = {'name': task_list} | |
285 if task_start_to_close_timeout is not None: | |
286 attrs['taskStartToCloseTimeout'] = task_start_to_close_timeout | |
287 self._data.append(o) |