DiamondLightSource / hyperion

Unattended Data Collection using BlueSky / Ophyd
BSD 3-Clause "New" or "Revised" License
6 stars 5 forks source link

Beamsize not being correctly put into ispyb #1412

Closed olliesilvester closed 4 months ago

olliesilvester commented 4 months ago

When testing the new release, we found that the beamsize wasn't being put into ispyb: https://ispyb.diamond.ac.uk/dc/visit/cm37235-2/id/14117910

Acceptance Criteria

Issue identified, fixed, and tested

DominicOram commented 4 months ago

@dperl-dls thinks it may be fixed. To check:

rtuck99 commented 4 months ago

Seems like the code was there, read_hardware_for_ispyb_pre_collection gets called, however none of the hardware read info is saved to the DB.

In the ispyb_callback log file for the collection we can see:

[2024-05-21 14:23:02,813] Hyperion ISPyB and Zocalo callbacks plan_reactive_callback ERROR: DatabaseError(-1): Traceback (most recent call last):
  File "/dls_sw/i03/software/bluesky/hyperion_v9.3.1/hyperion/.venv/lib/python3.11/site-packages/mysql/connector/cursor.py", line 564, in _process_params
    res = [to_mysql(value) for value in res]
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/dls_sw/i03/software/bluesky/hyperion_v9.3.1/hyperion/.venv/lib/python3.11/site-packages/mysql/connector/cursor.py", line 564, in <listcomp>
    res = [to_mysql(value) for value in res]
           ^^^^^^^^^^^^^^^
  File "/dls_sw/i03/software/bluesky/hyperion_v9.3.1/hyperion/.venv/lib/python3.11/site-packages/mysql/connector/conversion.py", line 237, in to_mysql
    raise TypeError(
TypeError: Python 'ca_float' cannot be converted to a MySQL type

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/dls_sw/i03/software/bluesky/hyperion_v9.3.1/hyperion/.venv/lib/python3.11/site-packages/ispyb/connector/mysqlsp/main.py", line 97, in call_sp_write
    result_args = cursor.callproc(procname=procname, args=args)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/dls_sw/i03/software/bluesky/hyperion_v9.3.1/hyperion/.venv/lib/python3.11/site-packages/mysql/connector/cursor.py", line 950, in callproc
    self.execute(f"SET {placeholders}", argvalues)
  File "/dls_sw/i03/software/bluesky/hyperion_v9.3.1/hyperion/.venv/lib/python3.11/site-packages/mysql/connector/cursor.py", line 730, in execute
    psub = _ParamSubstitutor(self._process_params(params))
                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/dls_sw/i03/software/bluesky/hyperion_v9.3.1/hyperion/.venv/lib/python3.11/site-packages/mysql/connector/cursor.py", line 571, in _process_params
    raise ProgrammingError(
mysql.connector.errors.ProgrammingError: Failed processing format-parameters; Python 'ca_float' cannot be converted to a MySQL type
Traceback (most recent call last):
  File "/dls_sw/i03/software/bluesky/hyperion_v9.3.1/hyperion/.venv/lib/python3.11/site-packages/mysql/connector/cursor.py", line 564, in _process_params
    res = [to_mysql(value) for value in res]
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/dls_sw/i03/software/bluesky/hyperion_v9.3.1/hyperion/.venv/lib/python3.11/site-packages/mysql/connector/cursor.py", line 564, in <listcomp>
    res = [to_mysql(value) for value in res]
           ^^^^^^^^^^^^^^^
  File "/dls_sw/i03/software/bluesky/hyperion_v9.3.1/hyperion/.venv/lib/python3.11/site-packages/mysql/connector/conversion.py", line 237, in to_mysql
    raise TypeError(
TypeError: Python 'ca_float' cannot be converted to a MySQL type

etc

rtuck99 commented 4 months ago

This is a duplicate of DiamondLightSource/mx-bluesky#239