From 576e1a237fee1dcc18d4d66849052a26a6424f48 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emin=20Can=20O=C4=9Fuz?= Date: Thu, 20 Oct 2022 17:34:11 +0300 Subject: [PATCH 1/5] BugFix for Druid error exception --- airflow/providers/apache/druid/hooks/druid.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/airflow/providers/apache/druid/hooks/druid.py b/airflow/providers/apache/druid/hooks/druid.py index a5e8ba86540c0..1d472e1e8411e 100644 --- a/airflow/providers/apache/druid/hooks/druid.py +++ b/airflow/providers/apache/druid/hooks/druid.py @@ -89,7 +89,8 @@ def submit_indexing_job(self, json_index_spec: dict[str, Any] | str) -> None: self.log.info("Druid ingestion spec: %s", json_index_spec) req_index = requests.post(url, data=json_index_spec, headers=self.header, auth=self.get_auth()) if req_index.status_code != 200: - raise AirflowException(f'Did not get 200 when submitting the Druid job to {url}') + raise AirflowException(f'The error code of {url}: {req_index.request}') + req_json = req_index.json() # Wait until the job is completed From d29489a5b816655d43d8b45ed03373dd1852ecc3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emin=20Can=20O=C4=9Fuz?= Date: Thu, 20 Oct 2022 17:54:49 +0300 Subject: [PATCH 2/5] Added content for Druid ingestion error exception --- airflow/providers/apache/druid/hooks/druid.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/airflow/providers/apache/druid/hooks/druid.py b/airflow/providers/apache/druid/hooks/druid.py index 1d472e1e8411e..7c5d98a122964 100644 --- a/airflow/providers/apache/druid/hooks/druid.py +++ b/airflow/providers/apache/druid/hooks/druid.py @@ -89,7 +89,7 @@ def submit_indexing_job(self, json_index_spec: dict[str, Any] | str) -> None: self.log.info("Druid ingestion spec: %s", json_index_spec) req_index = requests.post(url, data=json_index_spec, headers=self.header, auth=self.get_auth()) if req_index.status_code != 200: - raise AirflowException(f'The error code of {url}: {req_index.request}') + raise AirflowException(f'The error code of {url}: {req_index.content}') req_json = req_index.json() From e82341ae30cb1c5366b870d7aa68b7b199c1fe9b Mon Sep 17 00:00:00 2001 From: Emin Can OGUZ <47830986+emincanoguz11@users.noreply.github.com> Date: Sat, 22 Oct 2022 18:45:15 +0300 Subject: [PATCH 3/5] Update airflow/providers/apache/druid/hooks/druid.py - Good choice for language Co-authored-by: Niko --- airflow/providers/apache/druid/hooks/druid.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/airflow/providers/apache/druid/hooks/druid.py b/airflow/providers/apache/druid/hooks/druid.py index 7c5d98a122964..f99ed6da6f348 100644 --- a/airflow/providers/apache/druid/hooks/druid.py +++ b/airflow/providers/apache/druid/hooks/druid.py @@ -89,7 +89,7 @@ def submit_indexing_job(self, json_index_spec: dict[str, Any] | str) -> None: self.log.info("Druid ingestion spec: %s", json_index_spec) req_index = requests.post(url, data=json_index_spec, headers=self.header, auth=self.get_auth()) if req_index.status_code != 200: - raise AirflowException(f'The error code of {url}: {req_index.content}') + raise AirflowException(f'Failed when submitting the Druid job to {url}. Status code: {req_index.status_code}, response: {req_index.content}') req_json = req_index.json() From 27a4f2ee718753bdd2b81a68ebda1c347daee376 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emin=20Can=20O=C4=9Fuz?= Date: Mon, 31 Oct 2022 08:54:36 +0300 Subject: [PATCH 4/5] BugFix - Change the python3 format --- airflow/providers/apache/druid/hooks/druid.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/airflow/providers/apache/druid/hooks/druid.py b/airflow/providers/apache/druid/hooks/druid.py index 7c5d98a122964..7e62a51956772 100644 --- a/airflow/providers/apache/druid/hooks/druid.py +++ b/airflow/providers/apache/druid/hooks/druid.py @@ -89,8 +89,8 @@ def submit_indexing_job(self, json_index_spec: dict[str, Any] | str) -> None: self.log.info("Druid ingestion spec: %s", json_index_spec) req_index = requests.post(url, data=json_index_spec, headers=self.header, auth=self.get_auth()) if req_index.status_code != 200: - raise AirflowException(f'The error code of {url}: {req_index.content}') - + raise AirflowException("Failed when submitting the Druid job to {}. Status code: {}, response: {}".format(url,req_index.status_code,req_index.content)) + req_json = req_index.json() # Wait until the job is completed From 0bc84827143fc10316d71eb81fcbf8da35312d67 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emin=20Can=20O=C4=9Fuz?= Date: Mon, 31 Oct 2022 08:59:47 +0300 Subject: [PATCH 5/5] BugFix - Python3 add format variable --- airflow/providers/apache/druid/hooks/druid.py | 6 ------ 1 file changed, 6 deletions(-) diff --git a/airflow/providers/apache/druid/hooks/druid.py b/airflow/providers/apache/druid/hooks/druid.py index ed7c14d4fd173..8175d61c5b899 100644 --- a/airflow/providers/apache/druid/hooks/druid.py +++ b/airflow/providers/apache/druid/hooks/druid.py @@ -89,14 +89,8 @@ def submit_indexing_job(self, json_index_spec: dict[str, Any] | str) -> None: self.log.info("Druid ingestion spec: %s", json_index_spec) req_index = requests.post(url, data=json_index_spec, headers=self.header, auth=self.get_auth()) if req_index.status_code != 200: -<<<<<<< HEAD raise AirflowException("Failed when submitting the Druid job to {}. Status code: {}, response: {}".format(url,req_index.status_code,req_index.content)) -======= - raise AirflowException(f'Failed when submitting the Druid job to {url}. Status code: {req_index.status_code}, response: {req_index.content}') - ->>>>>>> e82341ae30cb1c5366b870d7aa68b7b199c1fe9b - req_json = req_index.json() # Wait until the job is completed druid_task_id = req_json['task']