artiq/artiq
Michael Birtwell b895846322 Improve exception reports when exception can't be reconstructed
Artiq assumes that all exceptions raised by the kernel can be constructed with
a single string argument. This isn't always the case. Especially for
exceptions that originated in python and were propagated to the kernel over
rpc.

With out this change a mosek solver failure looks like:
```
ERROR    root:logging_tools.py:41 Terminating with exception (TypeError: __init__() missing 1 required positional argument: 'msg')
Traceback (most recent call last):
  File "/home/mb/.cache/pypoetry/virtualenvs/ion-transport-1-b41LI0-py3.8/lib/python3.8/site-packages/artiq/master/worker_impl.py", line 540, in main
    exp_inst.run()
  File "/home/mb/.cache/pypoetry/virtualenvs/ion-transport-1-b41LI0-py3.8/lib/python3.8/site-packages/artiq/test_tools/experiment.py", line 82, in wrapper
    meth()
  File "/home/mb/.cache/pypoetry/virtualenvs/ion-transport-1-b41LI0-py3.8/lib/python3.8/site-packages/artiq/language/core.py", line 54, in run_on_core
    return getattr(self, arg).run(run_on_core, ((self,) + k_args), k_kwargs)
  File "/home/mb/.cache/pypoetry/virtualenvs/ion-transport-1-b41LI0-py3.8/lib/python3.8/site-packages/artiq/coredevice/core.py", line 152, in run
    self.comm.serve(embedding_map, symbolizer, demangler)
  File "/home/mb/.cache/pypoetry/virtualenvs/ion-transport-1-b41LI0-py3.8/lib/python3.8/site-packages/artiq/coredevice/comm_kernel.py", line 720, in serve
    self._serve_exception(embedding_map, symbolizer, demangler)
  File "/home/mb/.cache/pypoetry/virtualenvs/ion-transport-1-b41LI0-py3.8/lib/python3.8/site-packages/artiq/coredevice/comm_kernel.py", line 699, in _serve_exception
    python_exn = python_exn_type(
TypeError: __init__() missing 1 required positional argument: 'msg'
```

With this change we get:
```
ERROR    root:logging_tools.py:41 Terminating with exception (RuntimeError: Exception type=<class 'mosek.Error'>, which couldn't be reconstructed (__init__() missing 1 required positional argument: 'msg'))
Core Device Traceback:
Traceback (most recent call first):
  File "/home/mb/oxionics/ion-transport/tests/test_end_to_end.py", line 280, in get_transport
    return self.seq.solve()
  File "/home/mb/oxionics/ion-transport/tests/test_end_to_end.py", line 288, in artiq_worker_test_end_to_end.TransportTestScan.run(..., ...) (RA=+0x2e4)
    self.seq.record(self.get_transport(1e-6 + 1e-7 * x))
mosek.Error(27): rescode.err_license_expired(1001): The license has expired.

End of Core Device Traceback
Traceback (most recent call last):
  File "/home/mb/oxionics/artiq/artiq/master/worker_impl.py", line 540, in main
    exp_inst.run()
  File "/home/mb/oxionics/artiq/artiq/test_tools/experiment.py", line 82, in wrapper
    meth()
  File "/home/mb/oxionics/artiq/artiq/language/core.py", line 54, in run_on_core
    return getattr(self, arg).run(run_on_core, ((self,) + k_args), k_kwargs)
  File "/home/mb/oxionics/artiq/artiq/coredevice/core.py", line 152, in run
    self.comm.serve(embedding_map, symbolizer, demangler)
  File "/home/mb/oxionics/artiq/artiq/coredevice/comm_kernel.py", line 732, in serve
    self._serve_exception(embedding_map, symbolizer, demangler)
  File "/home/mb/oxionics/artiq/artiq/coredevice/comm_kernel.py", line 714, in _serve_exception
    raise python_exn
RuntimeError: Exception type=<class 'mosek.Error'>, which couldn't be reconstructed (__init__() missing 1 required positional argument: 'msg')
```

Signed-off-by: Michael Birtwell <michael.birtwell@oxionics.com>
2022-09-26 20:25:13 +08:00
..
applets applets.simple: Actually forward dataset_prefixes when using IPC 2022-06-19 18:08:25 +01:00
browser gui: fix Python 3.10 PyQt float/int issues. Closes #1887 2022-05-29 08:43:25 +08:00
compiler ld.lld: translate TARGET2 reloc to relative 2022-05-31 18:26:06 +08:00
coredevice Improve exception reports when exception can't be reconstructed 2022-09-26 20:25:13 +08:00
dashboard dashboard moninj: add tooltip for off button 2022-09-19 10:19:54 +08:00
examples add aqctl_moninj_proxy to device dbs 2022-03-19 19:25:21 +08:00
firmware update SEEN_ASYNC_ERRORS in destination_survey 2022-06-18 15:46:49 +08:00
frontend afws_client: update 2022-09-19 16:58:41 +08:00
gateware Added DDS selection for Kasli tester variant 2022-09-02 17:14:23 +08:00
gui GUI log: Apply level and text filter to existing log messages (#1950) 2022-08-29 15:20:44 +08:00
language language/environment: support no argument manager 2022-07-28 17:55:25 +08:00
master Add method to check if termination is requested (#811, #1932) 2022-07-07 17:01:34 +08:00
sim ttl: Add target RTIO time argument to timestamp/count functions 2018-11-03 20:33:19 +08:00
test add log_tuples function (#1896) 2022-06-06 18:41:46 +08:00
wavesynth wavesynth: np.int is deprecated 2021-09-13 07:02:35 +08:00
__init__.py simplify versioneer 2020-07-30 00:54:07 +08:00
_version.py remove legacy versioning files 2022-03-06 18:30:08 +08:00
afws.pem add AFWS client 2022-02-07 14:28:00 +08:00
appdirs.py add appdirs 2016-07-18 16:40:18 +02:00
build_soc.py build_soc: build VexRiscv_G if not kasli v1.x 2021-11-08 16:59:08 +08:00
experiment.py artiq.experiment: merge language and coredevice namespaces 2016-01-25 17:24:00 -07:00
remoting.py artiq_flash: wrap paramiko commands in bash login shell 2021-05-27 21:44:10 +08:00
tools.py tools: fix importlib issue 2021-12-21 13:20:11 +08:00