Commit 4eb0c5a6 authored by Samuel GAIST's avatar Samuel GAIST
Browse files

[execution][messagehandlers] Add handling of remote write sync

parent f8eabdc4
......@@ -47,7 +47,6 @@ import logging
import zmq
import simplejson
import requests
import threading
from ..dataformat import DataFormat
......@@ -162,7 +161,7 @@ class MessageHandler(threading.Thread):
self.kill_callback()
self.stop.set()
break
except RuntimeError as e:
except RuntimeError:
import traceback
message = traceback.format_exc()
......@@ -173,10 +172,12 @@ class MessageHandler(threading.Thread):
self.kill_callback()
self.stop.set()
break
except:
except Exception:
import traceback
parser = lambda s: s if len(s) < 20 else s[:20] + "..."
def parser(s):
return s if len(s) < 20 else s[:20] + "..."
parsed_parts = " ".join([parser(k) for k in parts])
message = (
"A problem occurred while performing command `%s' "
......@@ -249,7 +250,7 @@ class MessageHandler(threading.Thread):
try:
data_source = self.data_sources[name]
except:
except Exception:
raise RemoteException("sys", "Unknown input: %s" % name)
logger.debug("send: %d infos", len(data_source))
......@@ -275,12 +276,12 @@ class MessageHandler(threading.Thread):
try:
data_source = self.data_sources[name]
except:
except Exception:
raise RemoteException("sys", "Unknown input: %s" % name)
try:
index = int(index)
except:
except Exception:
raise RemoteException("sys", "Invalid index: %s" % index)
(data, start_index, end_index) = data_source[index]
......@@ -351,6 +352,7 @@ class LoopMessageHandler(MessageHandler):
)
self.callbacks.update({"val": self.validate})
self.callbacks.update({"wrt": self.write})
self.executor = None
def setup(self, algorithm, prefix):
......@@ -401,3 +403,10 @@ class LoopMessageHandler(MessageHandler):
self.socket.send_string("True" if is_valid else "False", zmq.SNDMORE)
self.socket.send(data.pack())
def write(self):
""" Trigger a write on the output"""
logger.debug("recv: wrt")
self.executor.write()
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