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

ExternalTaskSensorAsync to support poke_interval #823

Merged
merged 2 commits into from
Dec 21, 2022
Merged
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
10 changes: 10 additions & 0 deletions astronomer/providers/core/sensors/external_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,14 @@


class ExternalTaskSensorAsync(ExternalTaskSensor): # noqa: D101
def __init__(
self,
poke_interval: float = 5.0,
**kwargs: Any,
) -> None:
super().__init__(**kwargs)
self.poke_interval = poke_interval

def execute(self, context: Context) -> None:
"""Correctly identify which trigger to execute, and defer execution as expected."""
execution_dates = self.get_execution_dates(context)
Expand All @@ -36,6 +44,7 @@ def execute(self, context: Context) -> None:
# then work out which result we have in execute_complete.
states=self.allowed_states + self.failed_states,
execution_dates=execution_dates,
poll_interval=self.poke_interval,
),
method_name="execute_complete",
)
Expand All @@ -47,6 +56,7 @@ def execute(self, context: Context) -> None:
task_id=self.external_task_id,
states=self.allowed_states + self.failed_states,
execution_dates=execution_dates,
poll_interval=self.poke_interval,
),
method_name="execute_complete",
)
Expand Down