Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import zmq
- import marshal
- import time
- import types
- context = zmq.Context(1)
- socket = context.socket(zmq.REP)
- socket.connect("ipc:///tmp/workers")
- while True:
- data = socket.recv_pyobj()
- code = marshal.loads(data['code'])
- fn = types.FunctionType(code, globals(), "loaded_func")
- message = str(fn(*data['args']))
- socket.send(message)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement