Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Definitions.merge #22035

Merged
merged 1 commit into from
May 23, 2024
Merged

Definitions.merge #22035

merged 1 commit into from
May 23, 2024

Conversation

sryza
Copy link
Contributor

@sryza sryza commented May 22, 2024

Summary & Motivation

There are diverse situations where it's useful to be able to pass around collections of definitions. Doing this in Dagster right now is quite awkward.

Relevant situations:

Unlike the prior version of this PR, this PR does not turn Definitions into a "dumb" data class. I.e. it still validates that all assets and jobs can be bound, at construction time.

How I Tested These Changes

Copy link
Member

@schrockn schrockn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great. Using the index number is a little goofy. I think it is more clear to list out the entire set of keys that you are trying to merge to give more context. Not super critical but something to consider addressing before merge.


with pytest.raises(
DagsterInvariantViolationError,
match="Definitions objects 0 and 1 both have a resource with key 'resource1'",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wording around "0 and 1" slightly goofy.

Slightly better might be:

"Trying to merge definitions with resources {"foo", "bar"} and {"bar", "baaz"}. {"bar"} conflicts"

or something

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops saw this and then forgot about it and then merged. Going to handle it in a followup.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No problem at all. Just a recommendation.

@sryza sryza force-pushed the definitions-merge-still-validate branch from 1681396 to ebcefd4 Compare May 23, 2024 17:22
@sryza sryza force-pushed the definitions-merge-still-validate branch from ebcefd4 to bb89bd4 Compare May 23, 2024 17:26
@sryza sryza merged commit 74d4826 into master May 23, 2024
1 check failed
@sryza sryza deleted the definitions-merge-still-validate branch May 23, 2024 20:13
danielgafni pushed a commit to danielgafni/dagster that referenced this pull request Jun 18, 2024
## Summary & Motivation

There are diverse situations where it's useful to be able to pass around
collections of definitions. Doing this in Dagster right now is quite
awkward.

Relevant situations:
- Writing a factory that returns a few assets, a few checks, and a job
that executes them together.
- A submodule defines a few assets, a job, and a schedule. A different
submodule does the same. They should all be in the same code location.
-
dagster-io#21387 (comment)
- https://github.com/dagster-io/internal/discussions/8216

Unlike the [prior version of this
PR](dagster-io#21746), this PR does
_not_ turn `Definitions` into a "dumb" data class. I.e. it still
validates that all assets and jobs can be bound, at construction time.

## How I Tested These Changes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants