Skip to content

Commit

Permalink
Migrate Microsoft example DAGs to new design apache#22452 - winrm
Browse files Browse the repository at this point in the history
  • Loading branch information
chethanuk committed Jun 2, 2022
1 parent f294a26 commit ab17d26
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 21 deletions.
17 changes: 0 additions & 17 deletions airflow/providers/microsoft/winrm/example_dags/__init__.py

This file was deleted.

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

Example DAGs <https://github.com/apache/airflow/tree/main/airflow/providers/microsoft/winrm/example_dags>
Example DAGs <https://github.com/apache/airflow/tree/main/tests/system/providers/microsoft/winrm>
PyPI Repository <https://pypi.org/project/apache-airflow-providers-microsoft-winrm/>
Installing from sources <installing-providers-from-sources>

Expand Down
4 changes: 2 additions & 2 deletions docs/apache-airflow-providers-microsoft-winrm/operators.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@ use the WinRMOperator to execute commands on a given remote host using the winrm

create a hook

.. exampleinclude:: /../../airflow/providers/microsoft/winrm/example_dags/example_winrm.py
.. exampleinclude:: /../../tests/system/providers/microsoft/winrm/example_winrm.py
:language: python
:dedent: 4
:start-after: [START create_hook]
:end-before: [END create_hook]

Run the operator, pass the hook, and pass a command to do something

.. exampleinclude:: /../../airflow/providers/microsoft/winrm/example_dags/example_winrm.py
.. exampleinclude:: /../../tests/system/providers/microsoft/winrm/example_winrm.py
:language: python
:dedent: 4
:start-after: [START run_operator]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
"""
This is an example dag for using the WinRMOperator.
"""
import os
from datetime import datetime, timedelta

from airflow import DAG
Expand All @@ -37,8 +38,12 @@
from airflow.providers.microsoft.winrm.hooks.winrm import WinRMHook
from airflow.providers.microsoft.winrm.operators.winrm import WinRMOperator


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

with DAG(
dag_id='POC_winrm_parallel',
dag_id=DAG_ID,
schedule_interval='0 0 * * *',
start_date=datetime(2021, 1, 1),
dagrun_timeout=timedelta(minutes=60),
Expand All @@ -61,3 +66,14 @@
# [END run_operator]

[t1, t2, t3] >> run_this_last

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 ab17d26

Please sign in to comment.