vatsrahul1001 commented on issue #36738:
URL: https://github.com/apache/airflow/issues/36738#issuecomment-1890315018
@ks233ever In your original code, please update the parameter in the
process() function to any value except reserved keywords. This adjustment
should make the code work for you. The DAG mentioned below has worked for me
```
from airflow import DAG
from airflow.operators.python import PythonVirtualenvOperator
from datetime import datetime, timedelta
default_args = {
'owner': 'airflow',
'start_date': datetime(2021, 1, 1),
'retries': 1,
'retry_delay': timedelta(minutes=5),
}
def process(interval_end, dag_run_details):
print(f"data interval is {interval_end} and dag run is
{dag_run_details}")
pass
with DAG(
dag_id='da_survey_presentation',
default_args=default_args,
schedule_interval='0 8 * * 1', # run once a week at midnight Pacific
every Monday morning
max_active_runs=1,
catchup=False,
concurrency=1,
on_failure_callback=partial(on_failure, stage),
sla_miss_callback=partial(sla_miss, stage),
start_date=datetime.datetime(2022, 1, 1),
is_paused_upon_creation=(stage != 'prod'),
tags=['da']
) as dag:
PythonVirtualenvOperator(
task_id="virtualenv_task",
python_callable=process,
op_args=[
'{{ data_interval_end }}', '{{ dag_run }}'
],
provide_context=True,
requirements=["google-api-python-client==1.6.7",
"df2gspread==1.0.4"],
system_site_packages=True,
dag=dag
)
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]