Skip to content

Commit

Permalink
Merge pull request #1 from datarobot/andrius/address-minor-comments-f…
Browse files Browse the repository at this point in the history
…rom-astronomer

Address minor comments from Astronomer.
  • Loading branch information
andrius-senulis authored Mar 25, 2022
2 parents a44a413 + d3ef496 commit e57f1ef
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 14 deletions.
16 changes: 5 additions & 11 deletions datarobot_provider/example_dags/datarobot_pipeline_dag.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@
# This is proprietary source code of DataRobot, Inc. and its affiliates.
#
# Released under the terms of DataRobot Tool and Utility Agreement.
from datetime import datetime

from airflow.decorators import dag
from airflow.utils.dates import days_ago

from datarobot_provider.operators.datarobot import (
CreateProjectOperator,
Expand All @@ -16,20 +17,13 @@
)
from datarobot_provider.sensors.datarobot import AutopilotCompleteSensor, ScoringCompleteSensor

# These args will get passed on to each operator
# You can override them on a per-task basis during operator initialization
default_args = {
'owner': 'airflow',
}


@dag(
default_args=default_args,
schedule_interval=None,
start_date=days_ago(2),
start_date=datetime(2022, 1, 1),
tags=['example'],
)
def DataRobot_Pipeline():
def datarobot_pipeline():
create_project_op = CreateProjectOperator(task_id='create_project')

train_models_op = TrainModelsOperator(
Expand Down Expand Up @@ -63,4 +57,4 @@ def DataRobot_Pipeline():
)


datarobot_pipeline = DataRobot_Pipeline()
datarobot_pipeline_dag = datarobot_pipeline()
6 changes: 3 additions & 3 deletions tests/unit/dags/test_datarobot_pipeline_dag.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import pytest
from airflow.models import DagBag

from datarobot_provider.example_dags.datarobot_pipeline_dag import DataRobot_Pipeline
from datarobot_provider.example_dags.datarobot_pipeline_dag import datarobot_pipeline


@pytest.fixture()
Expand All @@ -17,7 +17,7 @@ def dagbag(provider_dir):


def test_dag_loaded(dagbag):
dag = dagbag.get_dag(dag_id="DataRobot_Pipeline")
dag = dagbag.get_dag(dag_id="datarobot_pipeline")
assert dagbag.import_errors == {}
assert dag is not None
assert len(dag.tasks) == 6
Expand All @@ -32,7 +32,7 @@ def assert_dag_dict_equal(source, dag):


def test_dag_structure():
dag = DataRobot_Pipeline()
dag = datarobot_pipeline()
assert_dag_dict_equal(
{
"create_project": ["train_models", "check_autopilot_complete", "deploy_recommended_model"],
Expand Down

0 comments on commit e57f1ef

Please sign in to comment.