Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

don't check message type if BackOff #552

Merged
merged 1 commit into from
Aug 4, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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