Skip to content

Commit

Permalink
Update tutorials to remove Dagster code from __init__.py (code) (#2…
Browse files Browse the repository at this point in the history
…3346)

## Summary & Motivation

This PR updates tutorial examples to remove Dagster code from
`__init__.py`:
- tutorial
- tutorial_notebook_assets

## How I Tested These Changes

Deployed locally
BK with existing tests
  • Loading branch information
maximearmstrong authored and PedramNavid committed Aug 14, 2024
1 parent a76e24a commit 851d50d
Show file tree
Hide file tree
Showing 12 changed files with 36 additions and 33 deletions.
2 changes: 1 addition & 1 deletion examples/tutorial/dagster_cloud.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
locations:
- location_name: tutorial
code_source:
package_name: tutorial
module_name: tutorial.definitions
3 changes: 2 additions & 1 deletion examples/tutorial/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ requires = ["setuptools"]
build-backend = "setuptools.build_meta"

[tool.dagster]
module_name = "tutorial"
module_name = "tutorial.definitions"
code_location_name = "tutorial"
9 changes: 0 additions & 9 deletions examples/tutorial/tutorial/__init__.py
Original file line number Diff line number Diff line change
@@ -1,9 +0,0 @@
from dagster import Definitions, load_assets_from_modules

from . import assets

all_assets = load_assets_from_modules([assets])

defs = Definitions(
assets=all_assets,
)
9 changes: 9 additions & 0 deletions examples/tutorial/tutorial/definitions.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
from dagster import Definitions, load_assets_from_modules

from . import assets

all_assets = load_assets_from_modules([assets])

defs = Definitions(
assets=all_assets,
)
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,9 +0,0 @@
from dagster import Definitions, load_assets_from_package_module
from dagstermill import ConfigurableLocalOutputNotebookIOManager

from . import assets

defs = Definitions(
assets=load_assets_from_package_module(assets),
resources={"output_notebook_io_manager": ConfigurableLocalOutputNotebookIOManager()},
)
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def iris_dataset_finished():

iris_kmeans_jupyter_notebook_finished = define_dagstermill_asset(
name="iris_kmeans_jupyter_finished",
notebook_path=file_relative_path(__file__, "../notebooks/iris-kmeans.ipynb"),
notebook_path=file_relative_path(__file__, "notebooks/iris-kmeans.ipynb"),
ins={"iris": AssetIn("iris_dataset_finished")},
group_name="finished_tutorial",
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
from dagster import Definitions, load_assets_from_modules
from dagstermill import ConfigurableLocalOutputNotebookIOManager

from . import assets

defs = Definitions(
assets=load_assets_from_modules([assets]),
resources={"output_notebook_io_manager": ConfigurableLocalOutputNotebookIOManager()},
)
Original file line number Diff line number Diff line change
@@ -1,9 +0,0 @@
# from dagster import Definitions, load_assets_from_package_module
# from dagstermill import ConfigurableLocalOutputNotebookIOManager

# from . import assets

# defs = Definitions(
# assets=load_assets_from_package_module(assets),
# resources={"output_notebook_io_manager": ConfigurableLocalOutputNotebookIOManager()},
# )
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

# iris_kmeans_jupyter_notebook = define_dagstermill_asset(
# name="iris_kmeans_jupyter",
# notebook_path=file_relative_path(__file__, "../notebooks/iris-kmeans.ipynb"),
# notebook_path=file_relative_path(__file__, "notebooks/iris-kmeans.ipynb"),
# group_name="template_tutorial",
# # ins={"iris": AssetIn("iris_dataset")}, # this code to remain commented until TODO 3
# )
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# from dagster import Definitions, load_assets_from_modules
# from dagstermill import ConfigurableLocalOutputNotebookIOManager

# from . import assets

# defs = Definitions(
# assets=load_assets_from_modules([assets]),
# resources={"output_notebook_io_manager": ConfigurableLocalOutputNotebookIOManager()},
# )
6 changes: 4 additions & 2 deletions examples/tutorial_notebook_assets/workspace.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
load_from:
- python_package:
package_name: tutorial_template
package_name: tutorial_template.definitions
location_name: tutorial_template
- python_package:
package_name: tutorial_finished
package_name: tutorial_finished.definitions
location_name: tutorial_finished

0 comments on commit 851d50d

Please sign in to comment.