26 lines
660 B
Python
26 lines
660 B
Python
import logging
|
|
import shutil
|
|
import time
|
|
from datetime import datetime
|
|
from pprint import pprint
|
|
|
|
from airflow import DAG
|
|
from airflow.decorators import task
|
|
|
|
log = logging.getLogger(__name__)
|
|
|
|
with DAG(
|
|
dag_id='example_python_operator',
|
|
schedule_interval=None,
|
|
start_date=datetime(2021, 1, 1),
|
|
catchup=False,
|
|
tags=['example'],
|
|
) as dag:
|
|
# [START howto_operator_python]
|
|
@task(task_id="print_the_context")
|
|
def print_context(ds=None, **kwargs):
|
|
"""Print the Airflow context and ds variable from the context."""
|
|
print(ds)
|
|
return 'Whatever you return gets printed in the logs'
|
|
|
|
run_this = print_context() |