SameerMesiah97 commented on code in PR #63614:
URL: https://github.com/apache/airflow/pull/63614#discussion_r3142462803
##########
providers/microsoft/azure/src/airflow/providers/microsoft/azure/operators/synapse.py:
##########
@@ -255,30 +264,73 @@ def execute(self, context) -> None:
context["ti"].xcom_push(key="run_id", value=self.run_id)
if self.wait_for_termination:
- self.log.info("Waiting for pipeline run %s to terminate.",
self.run_id)
-
- if self.hook.wait_for_pipeline_run_status(
- run_id=self.run_id,
- expected_statuses=AzureSynapsePipelineRunStatus.SUCCEEDED,
- check_interval=self.check_interval,
- timeout=self.timeout,
- ):
- self.log.info("Pipeline run %s has completed successfully.",
self.run_id)
+ if not self.deferrable:
+ self.log.info("Waiting for pipeline run %s to terminate.",
self.run_id)
+ if self.hook.wait_for_pipeline_run_status(
+ run_id=self.run_id,
+ expected_statuses=AzureSynapsePipelineRunStatus.SUCCEEDED,
+ check_interval=self.check_interval,
+ timeout=self.timeout,
+ ):
+ self.log.info("Pipeline run %s has completed
successfully.", self.run_id)
+ else:
+ raise AzureSynapsePipelineRunException(
+ f"Pipeline run {self.run_id} has failed or has been
cancelled."
+ )
else:
- raise AzureSynapsePipelineRunException(
- f"Pipeline run {self.run_id} has failed or has been
cancelled."
+ end_time = time.time() + self.timeout
+
+ pipeline_run_status =
self.hook.get_pipeline_run_status(self.run_id)
+
+ if pipeline_run_status not in
AzureSynapsePipelineRunStatus.TERMINAL_STATUSES:
+ self.defer(
+ timeout=self.execution_timeout,
Review Comment:
Done.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]