Skip to content

Commit

Permalink
W&B integration follow up 2/ update example to defs (#12059)
Browse files Browse the repository at this point in the history
### Summary & Motivation
depends on #10470

this PR converts the example from using repository to defs as the entry
point, per changes in 1.1.7
(#11167)

### How I Tested These Changes
- local dagit can load
- unit test
  • Loading branch information
yuhan authored and smackesey committed Feb 8, 2023
1 parent 1390392 commit f0a7a2e
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 50 deletions.
3 changes: 3 additions & 0 deletions examples/with_wandb/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
[build-system]
requires = ["setuptools"]
build-backend = "setuptools.build_meta"

[tool.dagster]
module_name = "with_wandb"
38 changes: 38 additions & 0 deletions examples/with_wandb/with_wandb/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
from dagster import (
Definitions,
StringSource,
load_assets_from_package_module,
make_values_resource,
)
from dagster_wandb import wandb_artifacts_io_manager, wandb_resource

from . import assets
from .ops.launch.run_launch_agent import run_launch_agent_example
from .ops.launch.run_launch_job import run_launch_job_example
from .ops.partitioned_job import partitioned_job_example
from .ops.simple_job import simple_job_example

wandb_config = make_values_resource(
entity=StringSource,
project=StringSource,
)

defs = Definitions(
assets=load_assets_from_package_module(assets),
jobs=[
simple_job_example,
partitioned_job_example,
run_launch_agent_example,
run_launch_job_example,
],
resources={
"wandb_config": wandb_config.configured(
{
"entity": {"env": "WANDB_ENTITY"},
"project": {"env": "WANDB_PROJECT"},
}
),
"wandb_resource": wandb_resource.configured({"api_key": {"env": "WANDB_API_KEY"}}),
"io_manager": wandb_artifacts_io_manager.configured({"cache_duration_in_minutes": 60}),
},
)
Empty file.
45 changes: 0 additions & 45 deletions examples/with_wandb/with_wandb/repository.py

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
from with_wandb.repository import dagster_with_wandb
from with_wandb import defs


def test_can_load():
assert dagster_with_wandb.get_job("simple_job_example")
def test_defs_can_load():
assert defs.get_job_def("simple_job_example")
assert defs.get_job_def("partitioned_job_example")
assert defs.get_job_def("run_launch_agent_example")
assert defs.get_job_def("run_launch_job_example")
2 changes: 0 additions & 2 deletions examples/with_wandb/workspace.yaml

This file was deleted.

0 comments on commit f0a7a2e

Please sign in to comment.