Simon Osipov
Simon Osipov

Reputation: 424

Airflow to pass config from UI manual run

is there any way to pass JSON config from manual DAG run (the one from dag_run.conf['attribute'] to KubernetesPodOperator?

Tried to use the Jinja template on the templated field in YAML, but got an error, dag_run is not defined.

task_parse_raw_data = KubernetesPodOperator(
        namespace=NAMESPACE, 
        image='artifactory/image:tag',
        service_account_name='airflow',
        cmds=["sh", "/current.sh"],
        arguments=[ {{ dag_run.conf['date']}} ],
        ...)

Upvotes: 1

Views: 385

Answers (1)

Josh Fell
Josh Fell

Reputation: 3589

You need to wrap the Jinja expression in quotes like so:

arguments=[ "{{ dag_run.conf['date'] }}" ]

Upvotes: 2

Related Questions