From 6fc567efb59fa71a4cdc9ff99f4ac5cbd36b9155 Mon Sep 17 00:00:00 2001 From: Matthew Rossi Date: Sun, 1 Dec 2024 17:47:51 +0100 Subject: [PATCH] Handle missing status/applicationState fields --- charts/data-sanitization-service/Chart.yaml | 4 ++-- src/openapi_server/apis/job_api_base.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/charts/data-sanitization-service/Chart.yaml b/charts/data-sanitization-service/Chart.yaml index 730d30a..5f10402 100644 --- a/charts/data-sanitization-service/Chart.yaml +++ b/charts/data-sanitization-service/Chart.yaml @@ -1,5 +1,5 @@ apiVersion: v2 name: data-sanitization description: A Helm chart for Data Sanitization in Kubernetes -version: 0.2.3 -appVersion: "0.2.0" +version: 0.2.4 +appVersion: 0.2.1 diff --git a/src/openapi_server/apis/job_api_base.py b/src/openapi_server/apis/job_api_base.py index c2d23b5..fd78e4f 100644 --- a/src/openapi_server/apis/job_api_base.py +++ b/src/openapi_server/apis/job_api_base.py @@ -109,7 +109,7 @@ def get_job_status_by_id(jobId: str) -> JobStatus: ) LOGGER.info("Got Spark application data-sanitization-job-%s status", jobId) - jobStatus = api_response['status']['applicationState'] + jobStatus = api_response.get('status', {}).get('applicationState', {'state': 'UNKNOWN'}) except ApiException as error: LOGGER.error("Exception when getting Spark application " "data-sanitization-job-%s: %s", jobId, error)