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

Simple class to make attribute reference obvious #19982

Merged
merged 1 commit into from Dec 2, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 6 additions & 1 deletion tests/cluster_policies/__init__.py
Expand Up @@ -15,6 +15,7 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
from abc import ABC
from datetime import timedelta
from typing import Callable, List

Expand Down Expand Up @@ -77,8 +78,12 @@ def dag_policy(dag: DAG):
# [END example_dag_cluster_policy]


class TimedOperator(BaseOperator, ABC):
timeout: timedelta


# [START example_task_cluster_policy]
def task_policy(task: BaseOperator):
def task_policy(task: TimedOperator):
if task.task_type == 'HivePartitionSensor':
task.queue = "sensor_queue"
if task.timeout > timedelta(hours=48):
Expand Down