Skip to content

Commit

Permalink
Migrate Asana example DAGs to new design apache#22440
Browse files Browse the repository at this point in the history
  • Loading branch information
chethanuk authored and potiuk committed Jun 3, 2022
1 parent 1965bf0 commit 3000380
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 20 deletions.
17 changes: 0 additions & 17 deletions airflow/providers/asana/example_dags/__init__.py

This file was deleted.

2 changes: 1 addition & 1 deletion docs/apache-airflow-providers-asana/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ Content
:maxdepth: 1
:caption: Resources

Example DAGs <https://github.com/apache/airflow/tree/main/airflow/providers/asana/example_dags>
Example DAGs <https://github.com/apache/airflow/tree/main/tests/system/providers/asana/example_asana.py>

.. toctree::
:maxdepth: 1
Expand Down
6 changes: 6 additions & 0 deletions docs/apache-airflow-providers-asana/operators/asana.rst
Original file line number Diff line number Diff line change
Expand Up @@ -86,3 +86,9 @@ The AsanaUpdateTaskOperator minimally requires the task id to update and
the Asana connection to use to connect to your account (``conn_id``). There are many other
`task attributes you can overwrite <https://developers.asana.com/docs/update-a-task>`_
through the ``task_parameters``.

.. exampleinclude:: /../../tests/system/providers/asana/example_asana.py
:language: python
:dedent: 4
:start-after: [START asana_example_dag]
:end-before: [END asana_example_dag]
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,17 @@
ASANA_PROJECT_ID_OVERRIDE = os.environ.get("ASANA_PROJECT_ID_OVERRIDE", "test_project")
# This connection should specify a personal access token and a default project ID
CONN_ID = os.environ.get("ASANA_CONNECTION_ID")

ENV_ID = os.environ.get("SYSTEM_TESTS_ENV_ID")
DAG_ID = "example_asana"

with DAG(
"example_asana",
DAG_ID,
start_date=datetime(2021, 1, 1),
default_args={"conn_id": CONN_ID},
tags=["example"],
catchup=False,
) as dag:
# [START asana_example_dag]
# [START run_asana_create_task_operator]
# Create a task. `task_parameters` is used to specify attributes the new task should have.
# You must specify at least one of 'workspace', 'projects', or 'parent' in `task_parameters`
Expand Down Expand Up @@ -93,3 +95,15 @@
# [END run_asana_delete_task_operator]

create >> find >> update >> delete
# [END asana_example_dag]

from tests.system.utils.watcher import watcher

# This test needs watcher in order to properly mark success/failure
# when "tearDown" task with trigger rule is part of the DAG
list(dag.tasks) >> watcher()

from tests.system.utils import get_test_run # noqa: E402

# Needed to run the example DAG with pytest (see: tests/system/README.md#run_via_pytest)
test_run = get_test_run(dag)

0 comments on commit 3000380

Please sign in to comment.