forked from M-Labs/artiq
1
0
Fork 0

management/worker: improve error reporting

This commit is contained in:
Sebastien Bourdeauducq 2015-01-13 17:27:36 +08:00
parent 0bd54921af
commit 893c18679f
2 changed files with 4 additions and 2 deletions

View File

@ -2,6 +2,7 @@ import sys
import asyncio import asyncio
import subprocess import subprocess
import signal import signal
import traceback
from artiq.management import pyon from artiq.management import pyon
@ -78,7 +79,8 @@ class Worker:
data = self.handlers[action](**obj) data = self.handlers[action](**obj)
reply = {"status": "ok", "data": data} reply = {"status": "ok", "data": data}
except: except:
reply = {"status": "failed"} reply = {"status": "failed",
"message": traceback.format_exc()}
yield from self._send(reply, self.send_timeout) yield from self._send(reply, self.send_timeout)
@asyncio.coroutine @asyncio.coroutine

View File

@ -52,7 +52,7 @@ def make_parent_action(action, argnames, exception=ParentActionError):
if reply["status"] == "ok": if reply["status"] == "ok":
return reply["data"] return reply["data"]
else: else:
raise exception raise exception(reply["message"])
return parent_action return parent_action