You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2020/07/06 12:47:44 UTC
[GitHub] [airflow] mik-laj commented on a change in pull request #9692: Fix _process_executor_events method to use in-memory try_number
mik-laj commented on a change in pull request #9692:
URL: https://github.com/apache/airflow/pull/9692#discussion_r450196078
##########
File path: airflow/jobs/scheduler_job.py
##########
@@ -1509,9 +1512,10 @@ def _process_executor_events(self, simple_dag_bag, session=None):
filter_for_tis = TI.filter_for_tis(tis_with_right_state)
tis = session.query(TI).filter(filter_for_tis).all()
for ti in tis:
- key = ti.key
- dag_id, task_id, execution_date, try_number = key
- state, info = event_buffer.pop(key)
+ # Recreate ti_key (dag_id, task_id, execution_date, try_number) using in-memory try_number
+ buffer_key = (*ti.key[:-1], ti_key_to_try_number_map[ti.key[:-1]])
Review comment:
I would prefer to keep readability and unpack all values here, and then create a new key.
```
dag_id, task_id, execution_date, _ = ti.key
new_try_number = ti_key_to_try_number_map[(dag_id, task_id, execution_date)])
buffer_key = dag_id, task_id, execution_date, new_try_number
```
Slicing of the tuples is hard to read. Slicing of tuples is useful if you have a set of homogeneous elements.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org