[
https://issues.apache.org/jira/browse/AIRFLOW-915?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17010107#comment-17010107
]
Paul Rhodes commented on AIRFLOW-915:
-------------------------------------
This is no longer required since the it can be achieved by overriding the
render_template_fields method in the subclass, as the example below:
{code:java}
def render_template_fields(self, context, jinja_env=None):
super().render_template_fields(context, jinja_env)
context['params']['dynamic_param'] =
myfunction(context['execution_date'])
{code}
> Allow task context to be modified by pre_execute hook
> -----------------------------------------------------
>
> Key: AIRFLOW-915
> URL: https://issues.apache.org/jira/browse/AIRFLOW-915
> Project: Apache Airflow
> Issue Type: Improvement
> Components: operators
> Affects Versions: 1.8.0
> Reporter: Jeremiah Lowin
> Priority: Minor
>
> Currently, Operators do two things that prevent the pre_execute hook from
> modifying the jinja context:
> 1. the Operator templates are rendered immediately BEFORE calling pre_execute
> 2. even though a context was already generated for the operator, the context
> is regenerated for template rendering, meaning that modifications to the
> operator context wouldn't matter anyway.
> The proper course of events should be:
> 1. generate operator context
> 2. pass context to pre_execute where it could (potentially) be modified
> 3. use that context to render operator templates
--
This message was sent by Atlassian Jira
(v8.3.4#803005)