ashb commented on a change in pull request #20722:
URL: https://github.com/apache/airflow/pull/20722#discussion_r780170018
##########
File path: airflow/models/taskinstance.py
##########
@@ -477,6 +477,25 @@ def __init__(
# can be changed when calling 'run'
self.test_mode = False
+ @staticmethod
+ def insert_mapping(run_id: str, task: "BaseOperator") -> dict:
+ """:meta private:"""
+ return {
+ 'dag_id': task.dag_id,
+ 'task_id': task.task_id,
+ 'run_id': run_id,
+ '_try_number': 0,
+ 'unixname': getuser(),
+ 'queue': task.queue,
+ 'pool': task.pool,
+ 'pool_slots': task.pool_slots,
+ 'priority_weight': task.priority_weight_total,
+ 'run_as_user': task.run_as_user,
+ 'max_tries': task.retries,
+ 'executor_config': task.executor_config,
Review comment:
Covered by this existing test in test_taskinstances (and I verified that
it is going via the insert_mappings path too):
```python
def test_ti_updates_with_task(self, create_task_instance, session=None):
"""
test that updating the executor_config propagates to the
TaskInstance DB
"""
ti = create_task_instance(
dag_id='test_run_pooling_task',
task_id='test_run_pooling_task_op',
executor_config={'foo': 'bar'},
)
dag = ti.task.dag
ti.run(session=session)
tis = dag.get_task_instances()
assert {'foo': 'bar'} == tis[0].executor_config
```
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]