Python multiprocess.Manager() Examples
The following are 4
code examples of multiprocess.Manager().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
multiprocess
, or try the search function
.
Example #1
Source File: test_subscription_transport.py From graphql-python-subscriptions with MIT License | 6 votes |
def on_sub_mock(mocker): mgr = multiprocess.Manager() q = mgr.Queue() def on_subscribe(self, msg, params, websocket): new_params = copy.deepcopy(params) new_params.update({'context': msg.get('context', {})}) q.put(self) return new_params on_sub_mock = { 'on_subscribe': PickableMock(side_effect=promisify(on_subscribe), name='on_subscribe') } return on_sub_mock, q
Example #2
Source File: task.py From aio-framework with MIT License | 5 votes |
def __init__(self, task_data={}): self.id = str(uuid.uuid4()) self.data = task_data self.process = None manager = multiprocess.Manager() self.status_dict = manager.dict() self.set_status('') self.logs = manager.list() self.logger = utilities.create_logger(self.id)
Example #3
Source File: logger.py From uncertainpy with GNU General Public License v3.0 | 5 votes |
def __init__(self, filename, mode): logging.Handler.__init__(self) self.handler = logging.FileHandler(filename, mode) manager = multiprocess.Manager() self.queue = manager.Queue(-1) # self.queue = multiprocess.Queue(-1) self.is_closed = False self.t = threading.Thread(target=self.receive) self.t.daemon = True self.t.start()
Example #4
Source File: test_subscription_transport.py From graphql-python-subscriptions with MIT License | 5 votes |
def options_mocks(mocker): mgr = multiprocess.Manager() q = mgr.Queue() def on_subscribe(self, msg, params, websocket): new_params = copy.deepcopy(params) new_params.update({'context': msg.get('context', {})}) q.put(self) return new_params def on_connect(self, message, websocket): q.put(self) def on_disconnect(self, websocket): q.put(self) def on_unsubscribe(self, websocket): q.put(self) options_mocks = { 'on_subscribe': PickableMock(side_effect=promisify(on_subscribe), name='on_subscribe'), 'on_unsubscribe': PickableMock(side_effect=on_unsubscribe, name='on_unsubscribe'), 'on_connect': PickableMock( return_value={'test': 'test_context'}, side_effect=on_connect, name='on_connect'), 'on_disconnect': PickableMock(side_effect=on_disconnect, name='on_disconnect') } return options_mocks, q