Skip to content

Commit

Permalink
feat: add trigger_rule kwarg to scale ops
Browse files Browse the repository at this point in the history
  • Loading branch information
nicholasturner1 committed Jan 23, 2023
1 parent 451a813 commit 891553c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions dags/helper_ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,29 +131,29 @@ def wait_op(dag, process):
)


def scale_up_cluster_op(dag, stage, key, initial_size, total_size, queue):
def scale_up_cluster_op(dag, stage, key, initial_size, total_size, queue, trigger_rule="one_success"):
return PythonOperator(
task_id='resize_{}_{}'.format(stage, total_size),
python_callable=ramp_up_cluster,
op_args = [key, initial_size, total_size],
default_args=default_args,
weight_rule=WeightRule.ABSOLUTE,
priority_weight=1000,
trigger_rule="one_success",
trigger_rule=trigger_rule,
queue=queue,
dag=dag
)


def scale_down_cluster_op(dag, stage, key, size, queue):
def scale_down_cluster_op(dag, stage, key, size, queue, trigger_rule="all_success"):
return PythonOperator(
task_id='resize_{}_{}'.format(stage, size),
python_callable=ramp_down_cluster,
op_args = [key, size],
default_args=default_args,
weight_rule=WeightRule.ABSOLUTE,
priority_weight=1000,
trigger_rule="all_done",
trigger_rule=trigger_rule,
queue=queue,
dag=dag
)
Expand Down

0 comments on commit 891553c

Please sign in to comment.