From 2124dff15f38ecfafc10eb581c799470bcf336d9 Mon Sep 17 00:00:00 2001 From: Maxime Armstrong Date: Wed, 31 Jul 2024 08:14:16 -0700 Subject: [PATCH] lint and fix test --- .../project_fully_featured/definitions.py | 33 +++++++------------ .../project_fully_featured/project.py | 1 - .../resources/__init__.py | 6 ---- .../project_fully_featured_tests/test_defs.py | 2 +- .../test_snowflake_io_manager.py | 2 +- 5 files changed, 14 insertions(+), 30 deletions(-) diff --git a/examples/project_fully_featured/project_fully_featured/definitions.py b/examples/project_fully_featured/project_fully_featured/definitions.py index 5e9088b7b0992..8611c9b86fd7c 100644 --- a/examples/project_fully_featured/project_fully_featured/definitions.py +++ b/examples/project_fully_featured/project_fully_featured/definitions.py @@ -1,29 +1,24 @@ import os -from dagster import Definitions +from dagster import Definitions, load_assets_from_package_module +from dagster_aws.s3 import S3Resource +from dagster_aws.s3.io_manager import S3PickleIOManager +from dagster_dbt import DbtCliResource +from dagster_pyspark import pyspark_resource -from .assets import ( - activity_analytics, - core, - recommender, - dbt -) +from .assets import activity_analytics, core, dbt, recommender from .constants import ACTIVITY_ANALYTICS, CORE, RECOMMENDER from .jobs import activity_analytics_assets_sensor, core_assets_schedule, recommender_assets_sensor -from .project import dbt_project, DBT_PROJECT_DIR +from .project import DBT_PROJECT_DIR, dbt_project from .resources.duckdb_parquet_io_manager import DuckDBPartitionedParquetIOManager from .resources.hn_resource import HNAPIClient, HNAPISubsampleClient -from .resources.parquet_io_manager import LocalPartitionedParquetIOManager, S3PartitionedParquetIOManager +from .resources.parquet_io_manager import ( + LocalPartitionedParquetIOManager, + S3PartitionedParquetIOManager, +) from .resources.snowflake_io_manager import SnowflakeIOManager from .sensors.slack_on_failure_sensor import make_slack_on_failure_sensor -from dagster import load_assets_from_package_module -from dagster_aws.s3 import S3Resource -from dagster_aws.s3.io_manager import S3PickleIOManager -from dagster_dbt import DbtCliResource -from dagster_pyspark import pyspark_resource - - core_assets = load_assets_from_package_module(core, group_name=CORE) activity_analytics_assets = load_assets_from_package_module( @@ -32,10 +27,7 @@ group_name=ACTIVITY_ANALYTICS, ) -recommender_assets = load_assets_from_package_module( - recommender, - group_name=RECOMMENDER -) +recommender_assets = load_assets_from_package_module(recommender, group_name=RECOMMENDER) dbt_assets = load_assets_from_package_module(dbt) @@ -44,7 +36,6 @@ *recommender_assets, *activity_analytics_assets, *dbt_assets, - ] dbt_local_resource = DbtCliResource( diff --git a/examples/project_fully_featured/project_fully_featured/project.py b/examples/project_fully_featured/project_fully_featured/project.py index 95409ff2d56ca..4bbf80efb8a88 100644 --- a/examples/project_fully_featured/project_fully_featured/project.py +++ b/examples/project_fully_featured/project_fully_featured/project.py @@ -2,7 +2,6 @@ from dagster_dbt import DbtProject - DBT_PROJECT_DIR = Path(__file__).joinpath("..", "..", "dbt_project").resolve() dbt_project = DbtProject( diff --git a/examples/project_fully_featured/project_fully_featured/resources/__init__.py b/examples/project_fully_featured/project_fully_featured/resources/__init__.py index 97979ff9e8fdd..8b137891791fe 100644 --- a/examples/project_fully_featured/project_fully_featured/resources/__init__.py +++ b/examples/project_fully_featured/project_fully_featured/resources/__init__.py @@ -1,7 +1 @@ -import os -from dagster._utils import file_relative_path - - - -DBT_PROJECT_DIR = file_relative_path(__file__, "../../dbt_project") diff --git a/examples/project_fully_featured/project_fully_featured_tests/test_defs.py b/examples/project_fully_featured/project_fully_featured_tests/test_defs.py index 6534f781d3f43..c4cebcfea0885 100644 --- a/examples/project_fully_featured/project_fully_featured_tests/test_defs.py +++ b/examples/project_fully_featured/project_fully_featured_tests/test_defs.py @@ -1,4 +1,4 @@ -from project_fully_featured import defs +from project_fully_featured.definitions import defs def test_defs_can_load(): diff --git a/examples/project_fully_featured/project_fully_featured_tests/test_resources/test_snowflake_io_manager.py b/examples/project_fully_featured/project_fully_featured_tests/test_resources/test_snowflake_io_manager.py index 22071b665ed47..ca340b20dd75e 100644 --- a/examples/project_fully_featured/project_fully_featured_tests/test_resources/test_snowflake_io_manager.py +++ b/examples/project_fully_featured/project_fully_featured_tests/test_resources/test_snowflake_io_manager.py @@ -11,7 +11,7 @@ from pyspark.sql import Row, SparkSession from pyspark.sql.types import IntegerType, StringType, StructField, StructType -from project_fully_featured.resources import SHARED_SNOWFLAKE_CONF +from project_fully_featured.definitions import SHARED_SNOWFLAKE_CONF from project_fully_featured.resources.snowflake_io_manager import ( SnowflakeIOManager, connect_snowflake,