-
Notifications
You must be signed in to change notification settings - Fork 124
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[AP-832] Defined partial sync (#1054)
* implementing defined partial sync
- Loading branch information
Showing
23 changed files
with
1,218 additions
and
395 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import multiprocessing | ||
import traceback | ||
|
||
|
||
class Process(multiprocessing.Process): | ||
""" | ||
This is an extension of Process to let catching raised exceptions inside the | ||
process. | ||
""" | ||
def __init__(self, *args, **kwargs): | ||
multiprocessing.Process.__init__(self, *args, **kwargs) | ||
self._pconn, self._cconn = multiprocessing.Pipe() | ||
self._exception = None | ||
|
||
def run(self): | ||
try: | ||
multiprocessing.Process.run(self) | ||
self._cconn.send(None) | ||
except Exception as exp: | ||
t_b = traceback.format_exc() | ||
self._cconn.send((exp, t_b)) | ||
|
||
@property | ||
def exception(self): | ||
""" | ||
Returning exception of the process | ||
""" | ||
if self._pconn.poll(): | ||
self._exception = self._pconn.recv() | ||
return self._exception |
Oops, something went wrong.