Skip to content

Commit

Permalink
set processing_times to null in JOB_FAILED step
Browse files Browse the repository at this point in the history
  • Loading branch information
jtherrmann committed Nov 12, 2024
1 parent 82cc413 commit 7aa9374
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 24 deletions.
3 changes: 0 additions & 3 deletions apps/check-processing-time/src/check_processing_time.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@ def get_time_from_result(result: Union[list, dict]) -> Union[list, float]:


def lambda_handler(event, _) -> Optional[list[Union[list, float]]]:
if event['processing_failed']:
return None

processing_results = event['processing_results']
result_list = [processing_results[key] for key in sorted(processing_results.keys())]
return get_time_from_result(result_list)
6 changes: 2 additions & 4 deletions apps/step-function.json.j2
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
"SET_DEFAULT_RESULTS": {
"Type": "Pass",
"Result": {
"processing_times": null,
"get_files": {
"logs": [],
"expiration_time": null
Expand Down Expand Up @@ -145,8 +144,7 @@
"Type": "Task",
"Resource": "${CheckProcessingTimeLambdaArn}",
"Parameters": {
"processing_results.$": "$.results.processing_results",
"processing_failed.$": "$.results.processing_failed"
"processing_results.$": "$.results.processing_results"
},
"Retry": [
{
Expand Down Expand Up @@ -209,7 +207,7 @@
"status_code": "FAILED",
"logs.$": "$.results.get_files.logs",
"expiration_time.$": "$.results.get_files.expiration_time",
"processing_times.$": "$.results.processing_times"
"processing_times": null
},
"Retry": [
{
Expand Down
17 changes: 0 additions & 17 deletions tests/test_check_processing_time.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

def test_lambda_handler():
event = {
'processing_failed': False,
'processing_results': {
'step_0': {
'StartedAt': 3000,
Expand All @@ -32,7 +31,6 @@ def test_lambda_handler():

def test_lambda_handler_invalid_result():
event = {
'processing_failed': False,
'processing_results': {
'step_0': {
'StartedAt': 1000,
Expand All @@ -44,7 +42,6 @@ def test_lambda_handler_invalid_result():
check_processing_time.lambda_handler(event, None)

event = {
'processing_failed': False,
'processing_results': {
'step_0': {
'StartedAt': 2000,
Expand All @@ -56,7 +53,6 @@ def test_lambda_handler_invalid_result():
check_processing_time.lambda_handler(event, None)

event = {
'processing_failed': False,
'processing_results': {
'step_0': {
'StartedAt': 3000,
Expand All @@ -76,16 +72,3 @@ def test_lambda_handler_invalid_result():
}
with pytest.raises(ValueError, match=r'^-0.2 <= 0.0$'):
check_processing_time.lambda_handler(event, None)


def test_lambda_handler_failed_job():
event = {
'processing_failed': True,
'processing_results': {
'step_0': {
'StartedAt': 3000,
'StoppedAt': 8700,
},
}
}
assert check_processing_time.lambda_handler(event, None) is None

0 comments on commit 7aa9374

Please sign in to comment.