Commit 2dde1a7c authored by Samuel GAIST's avatar Samuel GAIST
Browse files

[worker] Use utils.send_multiparts to ensure data is formatted correctly

parent 3b5c80ce
......@@ -32,6 +32,7 @@ import zmq
import socket
import simplejson
from .utils import send_multipart
class WorkerController(object):
......@@ -86,10 +87,11 @@ class WorkerController(object):
def destroy(self):
for worker in self.workers:
self.socket.send_multipart([
parts = [
worker,
WorkerController.SCHEDULER_SHUTDOWN,
])
]
send_multipart(self.socket, parts)
self.workers = []
......@@ -105,27 +107,30 @@ class WorkerController(object):
def execute(self, worker, job_id, configuration):
self.socket.send_multipart([
parts = [
worker,
WorkerController.EXECUTE,
b'%d' % job_id,
simplejson.dumps(configuration).encode('utf-8')
])
simplejson.dumps(configuration)
]
send_multipart(self.socket, parts)
def cancel(self, worker, job_id):
self.socket.send_multipart([
parts = [
worker,
WorkerController.CANCEL,
b'%d' % job_id,
])
]
send_multipart(self.socket, parts)
def ack(self, worker):
self.socket.send_multipart([
parts = [
worker,
WorkerController.ACK
])
]
send_multipart(self.socket, parts)
def process(self, timeout=0):
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment