snu-quiqcl / iquip

Ion trap Quantum computing User Interface Project
GNU General Public License v3.0
7 stars 0 forks source link

DAC monitor does not catch an exception case where the requested device does not exist #296

Closed kangz12345 closed 7 months ago

kangz12345 commented 7 months ago

Describe the bug

When requesting a DAC voltage change which is not in the artiq-proxy's config file, it returns None instead of an RID. Then iquip.apps.monitor does not catch this case, and emits the following error:

Traceback (most recent call last):
  File "C:\Users\QC109_3\iquip\iquip\apps\monitor.py", line 520, in run
    logger.info(
  File "C:\Users\QC109_3\.conda\envs\artiq\Lib\logging\__init__.py", line 1489, in info
    self._log(INFO, msg, args, **kwargs)
  File "C:\Users\QC109_3\.conda\envs\artiq\Lib\logging\__init__.py", line 1634, in _log
    self.handle(record)
  File "C:\Users\QC109_3\.conda\envs\artiq\Lib\logging\__init__.py", line 1644, in handle
    self.callHandlers(record)
  File "C:\Users\QC109_3\.conda\envs\artiq\Lib\logging\__init__.py", line 1706, in callHandlers
    hdlr.handle(record)
  File "C:\Users\QC109_3\.conda\envs\artiq\Lib\logging\__init__.py", line 978, in handle
    self.emit(record)
  File "C:\Users\QC109_3\iquip\iquip\apps\logger.py", line 56, in emit
    logMsg = self.format(record)
             ^^^^^^^^^^^^^^^^^^^
  File "C:\Users\QC109_3\.conda\envs\artiq\Lib\logging\__init__.py", line 953, in format
    return fmt.format(record)
           ^^^^^^^^^^^^^^^^^^
  File "C:\Users\QC109_3\.conda\envs\artiq\Lib\logging\__init__.py", line 687, in format
    record.message = record.getMessage()
                     ^^^^^^^^^^^^^^^^^^^
  File "C:\Users\QC109_3\.conda\envs\artiq\Lib\logging\__init__.py", line 377, in getMessage
    msg = msg % self.args
          ~~~~^~~~~~~~~~~
TypeError: %d format: a real number is required, not NoneType

Expected behavior

The error message should show that the requested device does not exist.

Expected causes and correction methods

Catch the case where the response is None.

Additional context

When we update the artiq proxy version, we introduced config_template.json, so maybe @BECATRUE updated the config file. Mistakenly DAC channels become [0, 1, 2, 3] and DDS channels [0, 1, 2, 3, 4, 5, 6, 7], which are swapped. So now DAC ch5 does not exist in artiq-proxy server.

BECATRUE commented 7 months ago

Mistakenly DAC channels become [0, 1, 2, 3] and DDS channels [0, 1, 2, 3, 4, 5, 6, 7], which are swapped.

Oh, I made that mistake.. Sorry for confusingšŸ˜‚