File tree Expand file tree Collapse file tree
xyz-jobs/xyz-job-steps/src/main/java/com/here/xyz/jobs/steps/execution Expand file tree Collapse file tree Original file line number Diff line number Diff line change 7676import software .amazon .awssdk .services .cloudwatchevents .model .RemoveTargetsRequest ;
7777import software .amazon .awssdk .services .cloudwatchevents .model .ResourceNotFoundException ;
7878import software .amazon .awssdk .services .cloudwatchevents .model .Target ;
79+ import software .amazon .awssdk .services .sfn .model .ExecutionDoesNotExistException ;
80+ import software .amazon .awssdk .services .sfn .model .ExecutionStatus ;
7981import software .amazon .awssdk .services .sfn .model .InvalidTokenException ;
8082import software .amazon .awssdk .services .sfn .model .SendTaskFailureRequest ;
8183import software .amazon .awssdk .services .sfn .model .SendTaskHeartbeatRequest ;
@@ -275,6 +277,19 @@ private void checkAsyncExecutionState() {
275277 If the issue persists, the step will fail after the heartbeat timeout.
276278 */
277279 logger .warn ("Unknown execution state for step {}" , getGlobalStepId (), e );
280+
281+ //Check if the StateMachine is still existing and if it is RUNNING. If not - unregister StateCheckTrigger.
282+ ExecutionStatus sfnExecutionStatus ;
283+ try {
284+ sfnExecutionStatus = SFNInspector .getSFNExecutionStatus (executionId );
285+ }catch (ExecutionDoesNotExistException e1 ){
286+ logger .info ("[{}] StateMachine already gone ..." , getGlobalStepId ());
287+ sfnExecutionStatus = ExecutionStatus .FAILED ;
288+ }
289+
290+ if (sfnExecutionStatus != ExecutionStatus .RUNNING )
291+ unregisterStateCheckTrigger ();
292+
278293 synchronizeStep ();
279294 //NOTE: No heartbeat must be sent to SFN in this case!
280295 }
You can’t perform that action at this time.
0 commit comments