You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "Colin Breame (JIRA)" <ji...@apache.org> on 2017/06/14 12:19:00 UTC

[jira] [Commented] (AIRFLOW-103) Allow jinja templates to be used in task params

    [ https://issues.apache.org/jira/browse/AIRFLOW-103?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16049115#comment-16049115 ] 

Colin Breame commented on AIRFLOW-103:
--------------------------------------

Totally agree that this is a common use case.

For example, you might have something like this:

{code}op = BashOperator(
	task_id = "task",
	bash_command = "do-something.sh {{params.path}}",
        params = {"path": "/path/to/thing/{{ds}}/thing.csv"},
        dag = dag
){code}

In this case, the bash_command will be expanded to:

{code}
  do-something.sh /path/to/thing/{{ds}}/things.csv
{code}

But should be expanded to:

{code}
  do-something.sh /path/to/thing/2017-06-14/things.csv
{code}


> Allow jinja templates to be used in task params
> -----------------------------------------------
>
>                 Key: AIRFLOW-103
>                 URL: https://issues.apache.org/jira/browse/AIRFLOW-103
>             Project: Apache Airflow
>          Issue Type: Improvement
>          Components: operators
>            Reporter: Paul Rhodes
>            Priority: Minor
>
> At present when defining an Operator it isn't possible to reference template variables such as {{ds}} in the params block.
> Enabling this makes it easier to reuse Operators with very similar configurations. An example of this might be a BashOperator which runs a large (possibly external) script that only has a couple of configuration changes used between different runs.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)