artiq/artiq/coredevice
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
..
__init__.py integrate new AD9914 driver 2018-05-13 23:29:35 +08:00
ad53xx.py zotino: default div_read unified with ad53xx at 16, fix ad53xx doc 2021-08-05 17:42:11 +08:00
ad9154_reg.py add back ad9154_reg.py 2017-06-19 23:45:32 +08:00
ad9154_spi.py firmware, sayma: port converter_spi to spi2 2018-03-01 11:19:18 +01:00
ad9910.py urukul: use default profile 2022-01-10 16:21:39 +08:00
ad9912.py coredevice: set default pow for ad9912 set_mu() 2021-12-06 12:34:55 +08:00
ad9912_reg.py coredevice/ad9912: add [untested, wip] 2017-11-24 18:47:46 +01:00
ad9914.py Coredevice Input Validation (#1447) 2020-05-17 15:09:11 +02:00
adf5356.py mirny: allow set attenuation with dB 2022-02-07 14:22:52 +08:00
adf5356_reg.py coredevice: adf5355: rename to adf5356 2020-11-10 10:49:22 +08:00
basemod_att.py basemod_att: fix imports 2020-01-20 20:14:24 +08:00
cache.py syscall: lower nowrite to inaccessiblememonly 2021-09-10 13:25:12 +08:00
comm_analyzer.py use device endian for core device protocols (#1591) 2021-01-22 16:33:21 +08:00
comm_kernel.py Improve exception reports when exception can't be reconstructed 2022-09-26 20:25:13 +08:00
comm_mgmt.py comm_mgmt: expect error on config_read 2022-05-19 16:48:59 +08:00
comm_moninj.py moninj: make receive_task private again 2022-07-02 17:58:24 +08:00
core.py core: support precompilation of kernels 2022-03-06 18:25:18 +08:00
coredevice_generic.schema.json Expose TTLClockGen for Kasli JSONs (#1886) 2022-05-06 13:33:42 +08:00
dac34h84.py phaser: fix coarse mixer register offset 2021-05-08 14:48:47 +01:00
dma.py documentation improvements 2018-09-26 12:12:37 +08:00
edge_counter.py fix permissions 2019-03-11 20:43:28 +08:00
exceptions.py fix typo 2022-01-26 07:51:35 +08:00
fastino.py fastino: add comments about sideeffects on v0.1 2022-02-16 14:42:22 +00:00
fmcdio_vhdci_eem.py fmcdio_vhdci_eem: cleanup and document 2018-07-20 09:57:03 +08:00
grabber.py grabber: work around windows numpy int peculiarity (same as a81c12de9) 2018-11-30 18:41:14 +08:00
i2c.py I2C API for PCA9547 support (#1860) 2022-03-01 15:07:53 +08:00
jsondesc.py reorganize JSON schema files 2021-01-16 10:43:14 +08:00
kasli_i2c.py I2C API for PCA9547 support (#1860) 2022-03-01 15:07:53 +08:00
mirny.py mirny: allow set attenuation with dB 2022-02-07 14:22:52 +08:00
novogorny.py coredevice: configurable initial backing state 2018-05-21 18:55:06 +02:00
phaser.py reverse to servo enable. hopefully adapted all comments etc. 2022-07-06 14:33:46 +00:00
rtio.py coredevice, firmware: Add rtio_input_timestamped_data 2018-12-15 00:35:04 +00:00
runtime.py artiq_dir: move out of tools to unlink dependencies 2016-01-25 18:15:50 -07:00
sampler.py coredevice: configurable initial backing state 2018-05-21 18:55:06 +02:00
sawg.py sawg: use new rtio_output() API 2018-11-08 20:16:30 +08:00
shiftreg.py shiftreg: fix get method 2019-12-21 14:17:22 +08:00
spi2.py Docs: fix build warnings (#1234) 2019-01-09 11:39:23 +08:00
spline.py sawg: use new rtio_output() API 2018-11-08 20:16:30 +08:00
suservo.py AD9910 driver feature extension and SUServo IIR readability (#1500) 2021-11-15 12:09:16 +08:00
trf372017.py Phaser upconverter: set phase-frequency detector to 62.5 MHz (close #1648) 2021-05-08 14:48:47 +01:00
ttl.py doc: clarify TTL direction control with buffered cards 2019-07-24 10:04:45 +08:00
urukul.py urukul: use default profile 2022-01-10 16:21:39 +08:00
zotino.py zotino: default div_read unified with ad53xx at 16, fix ad53xx doc 2021-08-05 17:42:11 +08:00