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

Standardize output passing to match expected CMA format #9

Merged
merged 1 commit into from
Nov 21, 2024
Merged
Show file tree
Hide file tree
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
10 changes: 6 additions & 4 deletions src/granule_to_sns.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,11 @@ def generate_message(granule: dict) -> dict:


def granule_to_sns(event: dict, _) -> dict:
client = boto3.client("sns")
granules = event["input"]["granules"]
payload = event["input"]

granules = payload["granules"]

client = boto3.client("sns")
sns_topic_arn = os.getenv("SNS_TOPIC_ARN")

for granule in granules:
Expand All @@ -46,10 +48,10 @@ def granule_to_sns(event: dict, _) -> dict:
},
)

return event
return payload


def lambda_handler(event, context):
def lambda_handler(event: dict, context) -> dict:
init_root_logger()
with log_errors():
return run_cumulus_task(granule_to_sns, event, context)
2 changes: 1 addition & 1 deletion tests/test_granule_to_sns.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,4 +105,4 @@ def test_generate_message(event, message):

def test_granule_to_sns(sns_client, event, mocker):
mocker.patch.object(sns_client, "publish", return_value={})
assert granule_to_sns(event, None) == event
assert granule_to_sns(event, None) == event["input"]
Loading