ShortCircuitOperator not skipping tasks #30842
-
Hello! I'm having a hard time figuring out an issue I have. I have a Dag responsible for updating an Optuna study. Training jobs are running during the study update, and as a consequence the study won't be finalized if the last training job finishes while the dag is running. Thus, if all training jobs have been launched, I want to wait for them using an External Task Sensor. If not, I want to skip the wait. Here are my tasks dependencies: metadata = get_metadata()
should_wait_bool = update_study.partial().expand(metadata=metadata)
should_wait_training_job(should_wait_bool) >> wait_training_job >> trigger_study_update() My ShortCircuitOperator: @task.short_circuit()
def should_wait_training_job(need_wait_training_job):
return need_wait_training_job wait_training_job is an ExternalTaskSensor. Here are the logs for the short-circuit task:
If anyone has an idea of what's happening that would help me greatly ! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hey, I'm new to Airflow, and haven't used it much yet. We are just getting started with it. I think, and also judging by the documentation for the
|
Beta Was this translation helpful? Give feedback.
Hey, I'm new to Airflow, and haven't used it much yet. We are just getting started with it. I think, and also judging by the documentation for the
ShortCircuitOperator
, it's considering the result asTrue
, and that's why it continues. From the documentation:[False]
is a truthy value in Python, since it's not an empty array. If you want the result to be falsy, you'll h…