| 34 | |
| 35 | |
| 36 | class _ExceptionWrapper: |
| 37 | def __init__(self, exc_type=None, exc_msg=None, where="in background"): |
| 38 | self.exc_type = exc_type |
| 39 | self.exc_msg = exc_msg |
| 40 | self.where = where |
| 41 | |
| 42 | def reraise(self): |
| 43 | if self.exc_type == "PlasmaStoreFull" or self.exc_type == queue.Full: |
| 44 | msg = "Caught {} {}.\nSolution: {}".format( |
| 45 | self.exc_type, |
| 46 | self.where, |
| 47 | 'Because of PlasmaStore out of memory, so you can fix it by using: os.environ["MGE_PLASMA_MEMORY"] = x000000000(4GB for default) or reduce the number-workers', |
| 48 | ) |
| 49 | raise RuntimeError(msg) |
| 50 | elif self.exc_type == "ObjectIDGetError": |
| 51 | logger.warning( |
| 52 | "ObjectID not found in plasma store, some data will be lost, try to reduce the number-workers for debugging!" |
| 53 | ) |
| 54 | return |
| 55 | else: |
| 56 | msg = "Caught {} {}.\nOriginal {}".format( |
| 57 | self.exc_type, self.where, self.exc_msg |
| 58 | ) |
| 59 | raise RuntimeError(msg) |
| 60 | |
| 61 | @staticmethod |
| 62 | def _serialize_Exception(val): |
| 63 | return {"exc_type": val.exc_type, "exc_msg": val.exc_msg, "where": val.where} |
| 64 | |
| 65 | @staticmethod |
| 66 | def _deserialize_Exception(data): |
| 67 | return _ExceptionWrapper(data["exc_type"], data["exc_msg"], data["where"]) |
| 68 | |
| 69 | |
| 70 | class _PlasmaStoreManager: |
no outgoing calls
no test coverage detected