Skip to content

Commit

Permalink
Use run_id for ti.mark_success_url (#23330)
Browse files Browse the repository at this point in the history
  • Loading branch information
bbovenzi authored Apr 28, 2022
1 parent 67e8bdd commit a5f9df5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
3 changes: 1 addition & 2 deletions airflow/models/taskinstance.py
Original file line number Diff line number Diff line change
Expand Up @@ -803,13 +803,12 @@ def log_url(self):
@property
def mark_success_url(self):
"""URL to mark TI success"""
iso = quote(self.execution_date.isoformat())
base_url = conf.get('webserver', 'BASE_URL')
return base_url + (
"/confirm"
f"?task_id={self.task_id}"
f"&dag_id={self.dag_id}"
f"&execution_date={iso}"
f"&dag_run_id={quote(self.run_id)}"
"&upstream=false"
"&downstream=false"
"&state=success"
Expand Down
3 changes: 2 additions & 1 deletion tests/models/test_taskinstance.py
Original file line number Diff line number Diff line change
Expand Up @@ -1312,7 +1312,8 @@ def test_mark_success_url(self, create_task_instance):
)
assert query['dag_id'][0] == 'dag'
assert query['task_id'][0] == 'op'
assert pendulum.parse(query['execution_date'][0]) == now
assert query['dag_run_id'][0] == 'test'
assert ti.execution_date == now

def test_overwrite_params_with_dag_run_conf(self, create_task_instance):
ti = create_task_instance()
Expand Down

0 comments on commit a5f9df5

Please sign in to comment.