Hi all,

There was an issue a while ago proposing to add more values into the context 
dict.[1] I responded at the time that the proposed values are already available 
by accessing 'ti' although it’s unclear whether the internals of the variable 
(which was a concrete SQLAlchemy model TaskInstance at the time) should be 
considered public.

Fast forward 11 months, with Task SDK implemented, 'ti' (and other things that 
used to be SQLAlchemy models, e.g. dag_run) are now only simple data constructs 
that do not provide any server-side functionalities.

We should first expand the template documentation to outline what attributes 
are available on the task instance, and encourage users to use them.[2] 

- dag_id
- run_id
- task_id
- try_number
- map_index
- hostname (not totally sure about this)

Furthermore, I am also wondering if we should remove try_number and run_id from 
the context dict. This is the exact same value as on the task instance, and 
they stand out a bit as not really necessary.

TP


[1]: https://github.com/apache/airflow/issues/40958
[2]: https://airflow.apache.org/docs/apache-airflow/stable/templates-ref.html
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@airflow.apache.org
For additional commands, e-mail: dev-h...@airflow.apache.org

Reply via email to