-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make 'multiple Definitions objects' error message more actionable (#2…
…5453) ## Summary Ran into this with a user - the "Cannot have more than one Definitions object defined at module scope." error can be a bit of a rabbithole to track down. The case we hit in particular was when one of the `Definitions` objects was being imported unknowingly. This PR updates the error message to include the names of all the located `Definitions` objects, so it's easier to track down where they're coming from and rectify the error. ## How I Tested These Changes Update unit tests. ## Changelog > Errors raised from defining more than one `Definitions` object at module scope now include the object names so that the source is easier to determine.
- Loading branch information
Showing
5 changed files
with
48 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
...cli_tests/workspace_tests/autodiscovery_tests/autodiscover_in_module_multiple/__init__.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
from dagster import Definitions | ||
|
||
from .defs1 import defs1 # noqa: TID252 | ||
from .defs2 import defs2 # noqa: TID252 | ||
|
||
defs = Definitions.merge( | ||
defs1, | ||
defs2, | ||
) |
3 changes: 3 additions & 0 deletions
3
...ts/cli_tests/workspace_tests/autodiscovery_tests/autodiscover_in_module_multiple/defs1.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
from dagster import Definitions | ||
|
||
defs1 = Definitions() |
3 changes: 3 additions & 0 deletions
3
...ts/cli_tests/workspace_tests/autodiscovery_tests/autodiscover_in_module_multiple/defs2.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
from dagster import Definitions | ||
|
||
defs2 = Definitions() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters