Skip to content

Commit

Permalink
Pass task output in standard CMA format
Browse files Browse the repository at this point in the history
  • Loading branch information
reweeden committed Nov 13, 2024
1 parent 60e7e0d commit be85fbd
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
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"]

0 comments on commit be85fbd

Please sign in to comment.