tango-controls/TangoTickets

Jive: Device property creation with empty value prevents Python device from starting

Closed this issue · 4 comments

Hi Tango developers,

when I create a Device property in Jive and do not assign a value to it, then the related Python device cannot start up. This is the relevant Python exception stack:

Exiting: Server exited with tango.DevFailed:
DevFailed[
DevError[
    desc = ValueError: could not convert string to float: 
           
  origin =   File "/venv/lib/python3.7/site-packages/tango/device_class.py", line 571, in __DeviceClass__device_factory
    device = self._new_device(deviceImplClass, klass, dev_name)
  File "/venv/lib/python3.7/site-packages/tango/device_class.py", line 550, in __DeviceClass__new_device
    return klass(dev_class, dev_name)
  File "/venv/lib/python3.7/site-packages/tango/server.py", line 577, in __init__
    self.init_device()
  File "/venv/lib/python3.7/site-packages/tango/server.py", line 366, in init_device
    return get_worker().execute(init_device_orig, self)
  File "/venv/lib/python3.7/site-packages/tango/green.py", line 98, in execute
    return fn(*args, **kwargs)
  File "/hosthome/foo/SKAPowerSupply.py", line 100, in init_device
    SKABaseDevice.init_device(self)
  File "/venv/lib/python3.7/site-packages/tango/server.py", line 366, in init_device
    return get_worker().execute(init_device_orig, self)
  File "/venv/lib/python3.7/site-packages/tango/green.py", line 98, in execute
    return fn(*args, **kwargs)
  File "/hosthome/skabase/SKABaseDevice/SKABaseDevice.py", line 377, in init_device
    Device.init_device(self)
  File "/venv/lib/python3.7/site-packages/tango/server.py", line 366, in init_device
    return get_worker().execute(init_device_orig, self)
  File "/venv/lib/python3.7/site-packages/tango/green.py", line 98, in execute
    return fn(*args, **kwargs)
  File "/venv/lib/python3.7/site-packages/tango/server.py", line 583, in init_device
    self.get_device_properties()
  File "/venv/lib/python3.7/site-packages/tango/server.py", line 613, in get_device_properties
    self, class_prop, self.device_property_list)
  File "/venv/lib/python3.7/site-packages/tango/device_class.py", line 142, in get_device_properties
    values = self.stringArray2values(prop_value, data_type)
  File "/venv/lib/python3.7/site-packages/tango/device_class.py", line 261, in stringArray2values
    return seqStr_2_obj(argin, argout_type)
  File "/venv/lib/python3.7/site-packages/tango/utils.py", line 897, in seqStr_2_obj
    return _seqStr_2_obj_from_type(seq, tg_type)
  File "/venv/lib/python3.7/site-packages/tango/utils.py", line 911, in _seqStr_2_obj_from_type
    return float(seq[0])

  reason = PyDs_PythonError
severity = ERR]
]

Exited

As soon as I assign a value to the device property, the device starts up just fine.

This can be reproduced every time. Jive version is 7.22 and I am using the virtual machine provided during the SKA Tango workshop in Perth.

Cheers
Thomas

Hi @tjuerges.

From the stack trace, the property data type is either DevDouble or DevFloat. If you don't specify a value for the property at all, the float cannot be initialised. Looks like Tango doesn't assume an empty string is equivalent to 0.0.

This could be handled by adding a default value in the property definition in the code.

class PowerSupply(Device):
   prop = device_property(dtype=DevDouble, default_value=0.0)

If you really want to add property in Jive that the code is unaware of, then that won't work for you. I guess just giving it a value of 0.0 in Jive would suffice.

@tjuerges Can we close this ticket, or do you have more questions or comments?

Closed stale ticket.

Sorry, this landed in my "do not do this today" folder and hence it never got any attention. Sorry again.

It is OK that you closed this ticket with the explanation that you provided. All good and understood.
There's only a catch remaining for normal users/developers: The user will be unaware of this when the user is using Pogo/Jive to create and configure devices. Therefore a warning/information dialog/something when Pogo/Jive encounters this to remind the user of the pending issue would be very useful.