-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
add pool as top-level definition arg #26256
base: master
Are you sure you want to change the base?
Conversation
3e46d69
to
0c1183c
Compare
python_modules/dagster/dagster/_core/definitions/decorators/asset_decorator.py
Outdated
Show resolved
Hide resolved
0c1183c
to
041872f
Compare
python_modules/dagster/dagster/_core/definitions/op_definition.py
Outdated
Show resolved
Hide resolved
addf80e
to
d288e73
Compare
e51874e
to
571ead4
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So before we move forward with this I think we need to have a naming session of concurrency group versus pool versus something else. Important decision with long term ramifications.
571ead4
to
238ba49
Compare
238ba49
to
a36d157
Compare
f52347d
to
ce97f66
Compare
Discussed offline, but putting here for posterity: I don't have plans to add |
ba49ba7
to
80d098b
Compare
Instead of hiding the pool arg in kwarg, just issued a |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
minor comments
@@ -808,6 +808,13 @@ def tags(self) -> Mapping[str, str]: | |||
"""The tags associated with the graph.""" | |||
return super().tags | |||
|
|||
@property | |||
def pools(self) -> set[str]: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: prefer from collections.abc import Set
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is that everyone's preference? the incidence of set
is like 4x the count of Set
:
(dagster) ➜ dagster git:(prha/asset_op_concurrency_key) s '\bset\[' | wc
423 2458 58005
(dagster) ➜ dagster git:(prha/asset_op_concurrency_key) s '\bSet\[' | wc
99 773 15437
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for typing yeah -- I imagine almost all of those lower case set
s are at runtime
until recently this was from typing import AbstractSet
, from collections.abc import Set
is the same thing but is now preferred by our linter -- this marks the return value as immutable, which has some value, but just in general I haven't seen set[x]
used as a return type anywhere else in the code so we should be consistent
|
||
@property | ||
@abstractmethod | ||
def pools(self) -> set[str]: ... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see above
@@ -286,6 +294,17 @@ def with_retry_policy(self, retry_policy: RetryPolicy) -> "PendingNodeInvocation | |||
"""Creates a copy of this op with the given retry policy.""" | |||
return super().with_retry_policy(retry_policy) | |||
|
|||
@property | |||
def pool(self) -> Optional[str]: | |||
"""Optional[str]: The concurrency group for this op.""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: should the docstring say pool instead of group?
@@ -644,9 +642,9 @@ def concurrency_event_iterator( | |||
): | |||
step = self.get_step_by_key(step_key) | |||
step_context = plan_context.for_step(step) | |||
step_concurrency_key = cast(str, step.tags.get(GLOBAL_CONCURRENCY_TAG)) | |||
pool = cast(str, step.pool) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: pre-existing, but should this be a check.str() instead of a cast?
@@ -159,6 +159,7 @@ class GraphDefSnap: | |||
dep_structure_snapshot: DependencyStructureSnapshot | |||
input_mapping_snaps: Sequence[InputMappingSnap] | |||
output_mapping_snaps: Sequence[OutputMappingSnap] | |||
pools: set[str] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see above
@@ -176,15 +177,39 @@ def get_output_snap(self, name: str) -> OutputDefSnap: | |||
|
|||
|
|||
@whitelist_for_serdes(storage_name="SolidDefSnap") | |||
@record | |||
class OpDefSnap: | |||
@record_custom |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why does this now need to be custom? does the backcompat not work if pool is just pool: Optional[str] = None
?
a120802
to
58ac167
Compare
58ac167
to
20be47d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
approving but I do think the return types should be Set[str] instead of set[str]
@@ -177,14 +178,15 @@ def get_output_snap(self, name: str) -> OutputDefSnap: | |||
|
|||
@whitelist_for_serdes(storage_name="SolidDefSnap") | |||
@record | |||
class OpDefSnap: | |||
class OpDefSnap(IHaveNew): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why IHaveNew here?
197d7c1
to
b7bfa67
Compare
b7bfa67
to
9d20984
Compare
Summary & Motivation
Tags are a bad mechanism for specifying concurrency controls. Adds a top-level argument
pool
to asset/op definitions to replace the use of op tags to specify concurrency conditions.This provides more cues for what you can place concurrency limits on (e.g. op defs not graph defs, asset defs not asset specs)
How I Tested These Changes
BK
Changelog
Adds a top-level argument
pool
to asset/op definitions to replace the use of op tags to specify concurrency conditions.