-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: support dynamic classes in multiprocessing (#16)
Need to set __module__ to __main__. uqfoundation/dill#56
- Loading branch information
1 parent
0dc5bdb
commit 1ef5dd4
Showing
3 changed files
with
52 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
from taskqueue import PrintTask | ||
|
||
import copy | ||
|
||
def crt_tasks(a,b): | ||
bounds = 5 | ||
|
||
class TaskIterator(): | ||
def __init__(self, x): | ||
self.x = x | ||
def __len__(self): | ||
return b-a | ||
def __getitem__(self, slc): | ||
itr = copy.deepcopy(self) | ||
itr.x = 666 | ||
return itr | ||
def __iter__(self): | ||
for i in range(a,b): | ||
yield PrintTask(str(i) + str(self.x)) | ||
|
||
return TaskIterator(bounds) |
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