Shen
Shen

Reputation: 3

Manually setting task's try number in Airflow

As the title says, in my operator, inside of its execute() method, I would like to do something like

if some_condition():
  self.try_number = 0

Because I want Airflow to forget about the previous failures. How would I do that?

Upvotes: 0

Views: 389

Answers (1)

lealvcon
lealvcon

Reputation: 158

I would not advise modifying try numbers since it would be difficult to debug in the future. But if you want to give it a try why don't you access the task_instance object and modify the parameters try_number or with_try_number?

I believe the latter lets you return your task with a given try number

Upvotes: 1

Related Questions