Skip to content
Closed
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
14 changes: 7 additions & 7 deletions tests/cluster_policies/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,15 +82,15 @@ def dag_policy(dag: DAG):


# [START example_task_cluster_policy]
class TimedOperator(BaseOperator, ABC):
timeout: timedelta
class MyCustomOperator(BaseOperator, ABC):
pass


def task_policy(task: TimedOperator):
if task.task_type == 'HivePartitionSensor':
task.queue = "sensor_queue"
if task.timeout > timedelta(hours=48):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is relative to the TimedOperator just above this policy though. The [START example_task_cluster_policy] marker was moved above the TimedOperator declaration in #23468 so it will show up in the Cluster Policy doc when published. Should the TimedOperator piece be removed altogether then?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems complex to change the whole example. everything I touch produce another error.
I'll leave it to someone more experienced with cluster policy.

task.timeout = timedelta(hours=48)
def task_policy(task: MyCustomOperator):
if task.task_type == 'BaseOperator':
task.queue = "priority_queue"
if task.execution_timeout > timedelta(hours=48):
task.execution_timeout = timedelta(hours=48)


# [END example_task_cluster_policy]
Expand Down