forked from M-Labs/artiq
management/worker: improve error reporting
This commit is contained in:
parent
0bd54921af
commit
893c18679f
|
@ -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
|
||||||
|
|
|
@ -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
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue