pythongoogle-cloud-platformairflowairflow-2.x

Fail to pass params through overrides on a CloudRunExecuteJobOperator


I'm trying to pass some parameters to the Cloud Run Job through the overrides field but in the job the xcom_pull is coming literally as "{{task_instance.xcom_pull(key='id_date')}}" and not as the corresponding value. The strange thing is that the xcom_pull is working on the job_name, but not on the overrides.

task_cloud_run = CloudRunExecuteJobOperator(
                     task_id    = 'cloud_run',
                     provide_context           = True,
                     project_id = "txd-scpn-pricing-dev",
                     region     = "us-central1",
                     overrides  = {"container_overrides": [{"env": [{"name": "id_date", "value": "{{task_instance.xcom_pull(key='id_date')}}" }],},],},
                     job_name   = "{{task_instance.xcom_pull(key='params_job_name')}}",
                     dag        = dag,
                     trigger_rule    = 'none_failed'
            )

I've tried to pass the value as "{{context['dag_run'].conf['id_date']}}" and nothing. I've also tried the value render_template_as_native_obj=True and it won't work.


Solution

  • I fixed the issued in December and it is available since the 10.13.0 version of the Google Provider

    Update your library and it will work!