Airflow Python Script with execution_date in op_kwargs : <p>With assistance from this answer <a href="https://stackoverflow.com/a/41730510/4200352">https://stackoverflow.com/a/41730510/4200352</a> I am executing a python file.</p>

<p>I use PythonOperator and am trying to include the execution date as an argument passed to the script.</p>

<p>I believe I can access it somehow through kwargs['execution_date'].</p>

<p>The below fails</p>

<p><strong>DAG.py</strong></p>

<pre><code>from airflow import DAG
from airflow.operators.python_operator import PythonOperator
from datetime import datetime, timedelta

import sys
import os
sys.path.append(os.path.abspath("/home/glsam/OmegaAPI/airflow/scripts/PyPer_ogi_simple"))
from update_benchmarks import *


default_args = {
    'owner': 'airflow',
    'depends_on_past': False,
    'start_date': datetime(2018, 4, 23),
    'email': ['airflow@example.com'],
    'email_on_failure': False,
    'email_on_retry': False,
    'retries': 1,
    'retry_delay': timedelta(minutes=5),
}

dag = DAG('run_pyPer', default_args=default_args)

update_BM_G027 = PythonOperator(
    task_id='update_BM_G027',
    python_callable=update_bmk,
    dag=dag,
    op_kwargs={
        'bmk_code': 'G027',
        'is_hedged': False,
        'from_date': kwargs['execution_date'],
    })
</code></pre>

<p>Do maybe i need to use this answer to get the date then XCOM it to the task? <a href="https://stackoverflow.com/a/36754930/4200352">https://stackoverflow.com/a/36754930/4200352</a></p>
