Skip to content

Commit

Permalink
Check status code before retrieving JSON in beast job submission (#116)
Browse files Browse the repository at this point in the history
  • Loading branch information
matt035343 authored Jul 5, 2024
1 parent d65c538 commit 44270ff
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions esd_services_api_client/beast/v3/_connector.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,10 @@ def _submit(self, request: JobRequest, spark_job_name: str) -> (str, str):
submission_result = self.http.post(
f"{self.base_url}/job/submit/{spark_job_name}", json=request_json
)
submission_json = submission_result.json()

if submission_result.status_code == 202 and submission_json:
if submission_result.status_code == 202 and (
submission_json := submission_result.json()
):
print(
f"Beast has accepted the request, stage: {submission_json['lifeCycleStage']}, id: {submission_json['id']}"
)
Expand Down

0 comments on commit 44270ff

Please sign in to comment.