Lance,

If you set the "templated_fields" attribute (on mobile so that might not
actually be correct) you can make your operator run any field through
jinja. See how BashOperator handles bash_command for an example.

Best,
Jeremiah

On Wed, May 25, 2016 at 6:40 PM Lance Norskog <[email protected]>
wrote:

> Ah! There's the problem. I'm using a home-made Operator that does not know
> how to use the templating engine, so this example does not count.
>
> It seems like I need to access the execution_date object.
>
>
> On Tue, May 24, 2016 at 11:15 PM, הילה ויזן <[email protected]> wrote:
>
> > a working example: {{ts}} is the execution date
> >
> > general_templated_cmd = """
> > <your command> {{ ts }} {{ task.task_id }} {{ dag.dag_id }}
> > """
> >
> > t1 = BashOperator(
> >     task_id='morning_task',
> >     bash_command=general_templated_cmd,
> >     dag=dag)
> >
> > On Wed, May 25, 2016 at 8:39 AM, Lance Norskog <[email protected]>
> > wrote:
> >
> > > My mad google skillz are failing me. Where is an example of getting the
> > > execution date into the python code in a DAG?
> > >
> > > I can't quite tell how to trigger the ninja template engine. Is there
> an
> > > example somewhere of this?
> > >
> > > --
> > > Lance Norskog
> > > [email protected]
> > > Redwood City, CA
> > >
> >
>
>
>
> --
> Lance Norskog
> [email protected]
> Redwood City, CA
>

Reply via email to