-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve support for the "spawn" start method in multiprocessing. This makes daisy more accessible to MacOS and Windows where "fork" is less convenient to use due to security concerns. To do this we use dill since dill can pickle a larger variety of objects than the default pickle library. Commits: * simplify tests use pytest functions instead of UnitTest classes Remove unnecessary lambdas (`lambda b: func(b)` is equivalent to `func`) * remove lambdas and double underscore methods these cannot be easily pickled so they can't be used with start_method="spawn" * improve task `process_func` signature parsing We don't care about kwargs with defaults, we only care about mandatory args. 1 mandatory arg means daisy knows to provide a thin worker wrapper and simply pass the blocks to your process function. 0 mandatory args means daisy can safely assume the function handles worker creation. * use dill to store the spawn function as bytes when creating a worker, we pass in a spawn function. Dill is an improved version of pickle so dill can serialize many more functions than pickle can. Thus we use dill to serialize the spawn function to bytes, which can then be serialized/deserialized by pickle when spawning subprocesses. Then when the worker needs to run the spawn function, we can use dill to deserialize the bytes into the desired function.
- Loading branch information
Showing
7 changed files
with
90 additions
and
75 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
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
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
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
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
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
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