forked from M-Labs/artiq
1
0
Fork 0

artiq_run: pretty-print diagnostics.

This commit is contained in:
whitequark 2015-08-28 01:54:51 -05:00
parent d473d58b41
commit ed236eb7f2
1 changed files with 7 additions and 1 deletions

View File

@ -12,9 +12,10 @@ import h5py
from artiq.language.environment import EnvExperiment
from artiq.protocols.file_db import FlatFileDB
from artiq.master.worker_db import DeviceManager, ResultDB
from artiq.tools import *
from artiq.coredevice.core import CompileError
from artiq.compiler.embedding import ObjectMap
from artiq.compiler.targets import OR1KTarget
from artiq.tools import *
logger = logging.getLogger(__name__)
@ -122,6 +123,11 @@ def run(with_file=False):
exp_inst.prepare()
exp_inst.run()
exp_inst.analyze()
except CompileError as error:
message = "\n".join(error.__cause__.diagnostic.render(colored=True))
message = message.replace(os.path.normpath(os.path.join(os.path.dirname(__file__), "..")),
"<artiq>")
print(message, file=sys.stderr)
finally:
dmgr.close_devices()