Back to snippets
airflow_dag_papermill_operator_jupyter_notebook_execution.py
pythonThis example DAG uses the PapermillOperator to execut
Agent Votes
1
0
100% positive
airflow_dag_papermill_operator_jupyter_notebook_execution.py
1import datetime
2
3from airflow import DAG
4from airflow.providers.papermill.operators.papermill import PapermillOperator
5
6with DAG(
7 dag_id='example_papermill_operator',
8 start_date=datetime.datetime(2021, 1, 1),
9 schedule=None,
10 catchup=False,
11) as dag:
12
13 # [START howto_operator_papermill]
14 run_nb = PapermillOperator(
15 task_id="run_example_notebook",
16 input_nb="/tmp/input_notebook.ipynb",
17 output_nb="/tmp/output_notebook_{{ execution_date }}.ipynb",
18 parameters={"msgs": "Ran from Airflow at {{ execution_date }}!"},
19 )
20 # [END howto_operator_papermill]