Skip to content

Commit

Permalink
Merge pull request #552 from hms-dbmi-cellenics/fix-backoff-lambda
Browse files Browse the repository at this point in the history
don't check message type if BackOff
  • Loading branch information
alexvpickering authored Aug 4, 2023
2 parents 8a6e032 + 3be4714 commit d3364b1
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions cf/sns.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -153,22 +153,22 @@ Resources:
"Content-Type": "application/json"
}
if message_body.get("reason") == "BackOff":
data = message_body
headers = application_json_headers
url = f"{os.getenv('DOMAIN_NAME')}/v2/kubernetesEvents"
pipeline_type_mappings = {
"PipelineResponse": "/v2/pipelineResults",
"GEM2SResponse": "/v2/gem2sResults",
"SeuratResponse": "/v2/seuratResults"
}
message_type = sns_message_payload["MessageAttributes"]["type"]["Value"]
if message_type in pipeline_type_mappings:
url = message_body.get('apiUrl') + pipeline_type_mappings[message_type]
data = sns_message_payload
headers = sns_message_headers
if message_body.get("reason") == "BackOff":
data = message_body
headers = application_json_headers
url = f"{os.getenv('DOMAIN_NAME')}/v2/kubernetesEvents"
else:
message_type = sns_message_payload["MessageAttributes"]["type"]["Value"]
if message_type in pipeline_type_mappings:
url = message_body.get('apiUrl') + pipeline_type_mappings[message_type]
data = sns_message_payload
headers = sns_message_headers
print("[ENDPOINT CALLED] ", url)
print("[DATA PAYLOAD] ", json.dumps(data))
Expand Down

0 comments on commit d3364b1

Please sign in to comment.