@@ -271,6 +271,27 @@ def add_activity_task_failed(self,
271
271
272
272
return self
273
273
274
+ def add_activity_task_timed_out (self ,
275
+ timeout_type ,
276
+ scheduled = None ,
277
+ started = None ):
278
+ if scheduled is None :
279
+ scheduled = self .last_id - 1
280
+
281
+ if started is None :
282
+ started = self .last_id
283
+
284
+ self .events .append (EventFactory ({
285
+ 'eventId' : self .next_id ,
286
+ 'eventTimestamp' : new_timestamp_string (),
287
+ 'eventType' : 'ActivityTaskTimedOut' ,
288
+ 'activityTaskTimedOutEventAttributes' : {
289
+ 'scheduledEventId' : scheduled ,
290
+ 'startedEventId' : started ,
291
+ 'timeoutType' : timeout_type ,
292
+ }
293
+ }))
294
+
274
295
def add_activity_task (self ,
275
296
activity ,
276
297
decision_id ,
@@ -280,7 +301,8 @@ def add_activity_task(self,
280
301
control = None ,
281
302
result = None ,
282
303
reason = DEFAULT_REASON ,
283
- details = DEFAULT_DETAILS ):
304
+ details = DEFAULT_DETAILS ,
305
+ timeout_type = 'START_TO_CLOSE' ):
284
306
self .add_activity_task_scheduled (
285
307
activity ,
286
308
decision_id ,
@@ -307,6 +329,11 @@ def add_activity_task(self,
307
329
started = started_id ,
308
330
reason = reason ,
309
331
details = details )
332
+ elif last_state == 'timed_out' :
333
+ self .add_activity_task_timed_out (
334
+ scheduled = scheduled_id ,
335
+ started = started_id ,
336
+ timeout_type = timeout_type )
310
337
else :
311
338
raise ValueError ('last state {} is not supported' .format (
312
339
last_state ))
0 commit comments