in infrastructure/emr_trigger/lambda_source/trigger.py [0:0]
def is_safe_to_run_new_execution(pipeline_arn, current_batch_id):
"""
Return true if no running executions found for that BatchId and a batch can be started - avoids duplicate clusters
:param pipeline_arn:
:param current_batch_id:
:return:
"""
response = sfn.list_executions(
stateMachineArn=pipeline_arn, statusFilter="RUNNING", maxResults=100
).get("executions", [])
if [x for x in response if x["name"] == f"BatchId_{current_batch_id}"]:
return False
else:
return True