Update example_python_operator.py
This commit is contained in:
@@ -2,8 +2,6 @@ import logging
|
|||||||
import shutil
|
import shutil
|
||||||
import time
|
import time
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from sklearn import linear_model
|
|
||||||
|
|
||||||
from airflow import DAG
|
from airflow import DAG
|
||||||
from airflow.decorators import task
|
from airflow.decorators import task
|
||||||
|
|
||||||
@@ -19,6 +17,7 @@ with DAG(
|
|||||||
# [START howto_operator_python]
|
# [START howto_operator_python]
|
||||||
@task.virtualenv(task_id="virtualenv_python", requirements=["sklearn"], system_site_packages=False)
|
@task.virtualenv(task_id="virtualenv_python", requirements=["sklearn"], system_site_packages=False)
|
||||||
def print_context(ds=None, **kwargs):
|
def print_context(ds=None, **kwargs):
|
||||||
|
from sklearn import linear_model
|
||||||
"""Print the Airflow context and ds variable from the context."""
|
"""Print the Airflow context and ds variable from the context."""
|
||||||
print(ds)
|
print(ds)
|
||||||
return 'Whatever you return gets printed in the logs'
|
return 'Whatever you return gets printed in the logs'
|
||||||
|
|||||||
Reference in New Issue
Block a user