Skip to content

Commit

Permalink
Fix ADF pipeline timeout issue (#602)
Browse files Browse the repository at this point in the history
  • Loading branch information
bharanidharan14 authored Aug 19, 2022
1 parent ea66057 commit 2d82aa9
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def execute(self, context: "Context") -> None:
)
run_id = vars(response)["run_id"]
context["ti"].xcom_push(key="run_id", value=run_id)
end_time = time.monotonic() + self.timeout
end_time = time.time() + self.timeout
self.defer(
timeout=self.execution_timeout,
trigger=AzureDataFactoryTrigger(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ async def run(self) -> AsyncIterator["TriggerEvent"]: # type: ignore[override]
factory_name=self.factory_name,
)
if self.wait_for_termination:
while self.end_time > time.monotonic():
while self.end_time > time.time():
pipeline_status = await hook.get_adf_pipeline_run_status(
run_id=self.run_id,
resource_group_name=self.resource_group_name,
Expand Down
4 changes: 2 additions & 2 deletions tests/microsoft/azure/triggers/test_data_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
AZ_RESOURCE_GROUP_NAME = "test-rg"
AZ_FACTORY_NAME = "test-factory"
AZ_DATA_FACTORY_CONN_ID = "test-conn"
AZ_PIPELINE_END_TIME = time.monotonic() + 60 * 60 * 24 * 7
AZ_PIPELINE_END_TIME = time.time() + 60 * 60 * 24 * 7


def test_adf_pipeline_run_status_sensors_trigger_serialization():
Expand Down Expand Up @@ -328,7 +328,7 @@ async def test_azure_data_factory_trigger_run_timeout(mock_pipeline_run_status):
resource_group_name=AZ_RESOURCE_GROUP_NAME,
factory_name=AZ_FACTORY_NAME,
azure_data_factory_conn_id=AZ_DATA_FACTORY_CONN_ID,
end_time=time.monotonic(),
end_time=time.time(),
)
generator = trigger.run()
actual = await generator.asend(None)
Expand Down

0 comments on commit 2d82aa9

Please sign in to comment.