pankajastro commented on code in PR #30074:
URL: https://github.com/apache/airflow/pull/30074#discussion_r1136654225
##########
airflow/providers/microsoft/azure/operators/data_factory.py:
##########
@@ -169,21 +176,55 @@ def execute(self, context: 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=AzureDataFactoryPipelineRunStatus.SUCCEEDED,
- check_interval=self.check_interval,
- timeout=self.timeout,
- resource_group_name=self.resource_group_name,
- factory_name=self.factory_name,
- ):
- self.log.info("Pipeline run %s has completed successfully.",
self.run_id)
+ if self.deferrable is False:
+ 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=AzureDataFactoryPipelineRunStatus.SUCCEEDED,
+ check_interval=self.check_interval,
+ timeout=self.timeout,
+ resource_group_name=self.resource_group_name,
+ factory_name=self.factory_name,
+ ):
+ self.log.info("Pipeline run %s has completed
successfully.", self.run_id)
+ else:
+ raise AzureDataFactoryPipelineRunException(
+ f"Pipeline run {self.run_id} has failed or has been
cancelled."
+ )
else:
- raise AzureDataFactoryPipelineRunException(
- f"Pipeline run {self.run_id} has failed or has been
cancelled."
+ end_time = time.time() + self.timeout
+ self.defer(
+ timeout=self.execution_timeout,
+ trigger=AzureDataFactoryTrigger(
+
azure_data_factory_conn_id=self.azure_data_factory_conn_id,
+ run_id=self.run_id,
+ wait_for_termination=self.wait_for_termination,
+ resource_group_name=self.resource_group_name,
+ factory_name=self.factory_name,
+ check_interval=self.check_interval,
+ end_time=end_time,
+ ),
+ method_name="execute_complete",
+ )
+ else:
+ if self.deferrable is True:
+ warnings.warn(
Review Comment:
hmm, no strong opinion but in 4th case, I'll slightly prefer to raise error
since 1st three handle all the scenario (sync_mode => wait, no_wait, async_mode
=> wait, no_wait) so 4th once should be invalid param. But as mention no strong
opinion
--
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]