-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Labels
enhancementNew feature or requestNew feature or requestgood first issueGood for newcomersGood for newcomers
Description
After #2 merged, we keep all comment but not keep indentation as old file. For now context manager and callable would have different indentation between old file. Here is the result we run command python ./example/transfer_tutorial.py, and we could see each BashOperator end close parenthesis would be add four blank, so as DAG contenxt. And DAG contenxt would also have leading newline in this example.
@@ -27,10 +27,10 @@
from textwrap import dedent
# The DAG object; we'll need this to instantiate a DAG
-from airflow import DAG
+from pydolphinscheduler.core.process_definition import ProcessDefinition
# Operators; we need this to operate!
-from airflow.operators.bash import BashOperator
+from pydolphinscheduler.tasks.shell import Shell
# [END import_module]
@@ -62,30 +62,24 @@
# [END default_args]
# [START instantiate_dag]
-with DAG(
- 'tutorial',
- default_args=default_args,
+with ProcessDefinition('tutorial',
description='A simple tutorial DAG',
- schedule_interval=timedelta(days=1),
- start_date=datetime(2021, 1, 1),
- catchup=False,
- tags=['example'],
-) as dag:
+ schedule=timedelta(days=1),
+ start_time=datetime(2021, 1, 1),
+ ) as dag:
# [END instantiate_dag]
# t1, t2 and t3 are examples of tasks created by instantiating operators
# [START basic_task]
- t1 = BashOperator(
- task_id='print_date',
- bash_command='date',
+ t1 = Shell(
+ name='print_date',
+ command='date',
)
- t2 = BashOperator(
- task_id='sleep',
- depends_on_past=False,
- bash_command='sleep 5',
- retries=3,
- )
+ t2 = Shell(
+ name='sleep',
+ command='sleep 5',
+ )
# [END basic_task]
# [START documentation]
@@ -116,13 +110,11 @@
"""
)
- t3 = BashOperator(
- task_id='templated',
- depends_on_past=False,
- bash_command=templated_command,
- params={'my_param': 'Parameter I passed in'},
- )
+ t3 = Shell(
+ name='templated',
+ command=templated_command,
+ )
# [END jinja_template]
t1 >> [t2, t3]
\ No newline at end of fileReactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or requestgood first issueGood for newcomersGood for newcomers