-
Notifications
You must be signed in to change notification settings - Fork 97
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
support call deps and bash deps #726
Merged
Merged
Conversation
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
Covalent's executors currently deserialize the callable in the server process. We introduce a light wrapper function which deserializes and invokes the callable and send the wrapper function to the Dask cluster or remote computer. This has two advantages: * Since the Covalent dispatcher never touches the deserialized callable, it doesn't need any of its dependencies. * When the the remote executor deserializes the wrapper function, the core callable remains serialized. This allows the wrapper to perform preparatory steps (such as running shell commands to install deps) before deserializing the callable.
This way, each executor can decide how to treat each kind of dep. For instance, a "dask" or "local" executor could ignore ModuleDeps. Also change Electron signature to accept a `deps` dictionary, e.g. @ct.electron(deps={"bash": BashDeps(...), "pip": PipDeps(...)})
This allows us to add new supported dep types without modifying each executor. On the downside, users may encounter unexpected behavior if they specify a dep type that's incompatible with the executor. Revisit executor-specific handling of different dep types in another issue.
Easier for autocompletion
Functions and args are immediately converted to TransportableObjects and only deserialized immediately before execution.
Codecov Report
@@ Coverage Diff @@
## develop #726 +/- ##
===========================================
- Coverage 73.59% 73.49% -0.10%
===========================================
Files 40 43 +3
Lines 2060 2177 +117
===========================================
+ Hits 1516 1600 +84
- Misses 544 577 +33
Continue to review full report at Codecov.
|
The idea is that all deps eventually reduce to `call_before` and `call_after`.
cjao
force-pushed
the
676-support-call-before
branch
from
June 26, 2022 00:59
60d0fb7
to
591afca
Compare
cjao
changed the title
support call_before and call_after
support call deps and bash deps
Jun 26, 2022
This change should allow all Deps to be implemented in a unified way. Subclasses are now implemented by defining a custom python function to apply the dependencies, and passing that function and associated data to the Base Deps constructor. The Base Deps serializes the function and arguments into TransportableObjects, and `apply()` simply returns a tuple of TransportableObjects: `(serialized_fn, serialized_args, serialized_kwargs)`
scottwn
approved these changes
Jun 28, 2022
This was referenced Jun 29, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes #676 and #677.
This implementation deviates slightly from the design doc. The Base Dep becomes essentially a CallDep, and the other deps essentially reduce to a CallDep with a dep-specific function.
Subclasses are now implemented by defining a custom python function to apply the dependencies, and passing that function and
associated data to the Base Deps constructor. The Base Deps serializes the function and arguments into
TransportableObjects, and
apply()
simply returns a tuple(serialized_fn, serialized_args, serialized_kwargs)
.The executor accepts a list of such tuples to be deserialized and invoked before and after the main function.
This design essentially ships the previous
apply()
function to the executor without shipping the entire Deps object.