We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e1a635e commit 7756f06Copy full SHA for 7756f06
runner/precise_runner/runner.py
@@ -62,9 +62,20 @@ def stop(self):
62
def get_prediction(self, chunk):
63
if len(chunk) != self.chunk_size:
64
raise ValueError('Invalid chunk size: ' + str(len(chunk)))
65
- self.proc.stdin.write(chunk)
66
- self.proc.stdin.flush()
67
- return float(self.proc.stdout.readline())
+ try:
+ self.proc.stdin.write(chunk)
+ self.proc.stdin.flush()
68
+ line = self.proc.stdout.readline()
69
+ except BrokenPipeError:
70
+ raise SystemExit(0)
71
+ if not line:
72
73
+ else:
74
75
+ return float(line)
76
+ except ValueError:
77
+ output = line + self.proc.stdout.read()
78
+ raise RuntimeError('Engine produced the following error: {}'.format(output))
79
80
81
class ListenerEngine(Engine):
0 commit comments