Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix ADF pipeline timeout issue #602

Merged
merged 1 commit into from
Aug 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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