Skip to content

Commit

Permalink
update bursar step function trigger
Browse files Browse the repository at this point in the history
Why are these changes being introduced:
The bursar step function call was throwing an error because the job
name being passed was not unique.

We also changed how we are passing the target and source s3 prefix to
the bursar lambda, so passing the Alma job name to the bursar step function
is no longer required.

relevant tickets:
https://mitlibraries.atlassian.net/browse/ENSY-178

https://mitlibraries.atlassian.net/browse/ENSY-172

How this addresses that need:
* add a timestamp to the step function execution name parameter so it is
unique.

* bursar transfer lambda only needs the
job ID, not the job name.
  • Loading branch information
adamshire123 committed Sep 8, 2023
1 parent b702ff3 commit c93910a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
8 changes: 3 additions & 5 deletions lambdas/webhook.py
Original file line number Diff line number Diff line change
Expand Up @@ -266,11 +266,9 @@ def generate_timdex_step_function_input(message_body: dict[str, Any]) -> tuple[s


def generate_bursar_step_function_input(message_body: dict[str, Any]) -> tuple[str, str]:
result = {
"job_id": message_body["job_instance"]["id"],
"job_name": message_body["job_instance"]["name"],
}
execution_name = "bursar"
timestamp = datetime.now(tz=UTC).strftime("%Y-%m-%dt%H-%M-%S")
result = {"job_id": message_body["job_instance"]["id"]}
execution_name = f"bursar-{timestamp}"
return json.dumps(result), execution_name


Expand Down
4 changes: 2 additions & 2 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,8 @@ def stubbed_bursar_sfn_client():
}
expected_params = {
"stateMachineArn": "arn:aws:states:us-east-1:account:stateMachine:bursar-test",
"input": '{"job_id": "test id", "job_name": "Bursar Export to test"}',
"name": "bursar",
"input": '{"job_id": "test id"}',
"name": "bursar-2022-05-01t00-00-00",
}
with Stubber(sfn) as stubber:
stubber.add_response("start_execution", expected_response, expected_params)
Expand Down

0 comments on commit c93910a

Please sign in to comment.