You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "shahar1 (via GitHub)" <gi...@apache.org> on 2026/01/24 16:15:19 UTC
Re: [PR] In GCP Datafusion hook handle start_pipeline() when response is None / Invalid [airflow]
shahar1 commented on code in PR #60688:
URL: https://github.com/apache/airflow/pull/60688#discussion_r2724306070
##########
providers/google/src/airflow/providers/google/cloud/hooks/datafusion.py:
##########
@@ -469,33 +477,50 @@ def start_pipeline(
is always default. If your pipeline belongs to an Enterprise edition instance, you
can create a namespace.
"""
- # TODO: This API endpoint starts multiple pipelines. There will eventually be a fix
- # return the run Id as part of the API request to run a single pipeline.
- # https://github.com/apache/airflow/pull/8954#discussion_r438223116
url = os.path.join(
instance_url,
"v3",
"namespaces",
quote(namespace),
"start",
)
+
runtime_args = runtime_args or {}
+ program_id = self.cdap_program_id(pipeline_type=pipeline_type)
body = [
{
"appId": pipeline_name,
+ "programType": "workflow" if pipeline_type == DataFusionPipelineType.BATCH else "spark",
Review Comment:
Small suggestion - maybe encapsulate the programType in an enum?
##########
providers/google/src/airflow/providers/google/cloud/hooks/datafusion.py:
##########
@@ -168,6 +171,11 @@ def _cdap_request(
@staticmethod
def _check_response_status_and_data(response, message: str) -> None:
+ if not response:
+ raise AirflowException(
+ "Invalid / Empty response received. Please, check for possible root "
+ "causes of this behavior either in DAG code or on Cloud DataFusion side"
+ )
Review Comment:
I'd like to ask to refactor all usages of `AirflowException` in the code, as according to a [recent policy](https://github.com/astronomer/airflow/blob/d8b768b71509b6895744d4d8a32f06a5daeebb12/contributing-docs/05_pull_requests.rst#dont-raise-airflowexception-directly) we want to avoid further usage of this exception at all (more about that in the [dev list thread](https://lists.apache.org/thread/5rv4tz0oc27bgr4khx0on0jz8fpxvh55)).
You may use a simple `ValueError` exception instead.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org