-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
[dagster cli] Add option to dagster definitions validate to load in-process #27459
base: master
Are you sure you want to change the base?
Conversation
This stack of pull requests is managed by Graphite. Learn more about stacking. |
464d815
to
42c2430
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.
Is there any reason not to just always load them in-process?
I think the main case in-process can't handle is validating multiple code locations w/ potentially different Python environments. The other thing is that locations can specify a python executable, that this won't address. Should explicitly test these cases & disallow the flag if they're present. |
I see-- this is good but I have a strong suspicion most users won't benefit if it's not the default behavior. Also it seems like if different code locations have different python environments, we still shouldn't need to start a code server-- couldn't we just resolve the python executable and run an in-process validation using the resolved executable? Seems like it would simplify things. |
Updated to default to loading in-process, with the above exceptions. Tagging @alangenfeld and @gibsondan since they might have a better idea if there are other nuances to be wary of here. |
42c2430
to
a0c8cae
Compare
|
||
|
||
@contextmanager | ||
def get_auto_determined_workspace_from_kwargs( |
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.
If we have this, do we even need to give the users the --load-with-grpc
option? IIUC we can just detect which method to use and fall back to grpc when necessary. If we do it this way then maybe we can eliminate it entirely later.
Just trying to avoid adding API surface.
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.
Yeah, that's fair. I figured it's sort of nice to have the flag to force consistently using gRPC if for some reason a user wants to make sure the command does the same thing each time, but don't feel strongly.
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.
IMO the method used to load the definitions should be treated as an implementation detail. If there are errors that would somehow only be found from gRPC startup, I would think that those errors are outside the scope of the commands expected output.
Maybe I'm wrong though, will let others weigh in.
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.
Requesting changes to resolve discussion raised by @smackesey. My inclination is to remove the grpc server option entirely as well, but would like @maximearmstrong and @gibsondan to weigh in
Summary
By default,
dagster definitions validate
starts up a gRPC server to load the code location. This adds a decent amount of runtime to the command (locally, for me, about 1s of a total 2.6s runtime).This PR instead defaults to loading the code location in-process, unless pointing at multiple code locations (via workspace.yaml) or a location which specifies an
executable_path
. This makes the command pretty quick, with the runtime almost entirely dominated by importing the user's code and loading the defintions (around 1.6s for a full components project for me).How I Tested These Changes
Update unit tests.
Changelog