phanikumv commented on code in PR #30074:
URL: https://github.com/apache/airflow/pull/30074#discussion_r1136637590
##########
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:
Please refer to
https://github.com/apache/airflow/pull/29014#discussion_r1073723719 for the
logic, and let me know in case it isnt according to this suggestion
--
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]