tango-simlib: Can't start DS!

Hello all,

I am evaluating tango-simlib. I have PyTango 9.2.1 (Tango 9.2.5) and I have downloaded tango-simlib. I have generated a simulator device
for the provided Weather class device interface. The command I used to generate the simulator was

tango-simlib-generator –sim-data-file Weather.xmi –directory  . –dserver-name Weather

Then I have manually created the DS entries in database. Attached is a window dump of Jive where my DS configuration is displayed.

Then, when I start the DS, I have the following error:

./Weather manu
Exiting: Server exited with tango.DevFailed:
DevFailed[
DevError[
    desc = RuntimeError: Could not find model with device name or key et/weather/01. Set the "model_key" device property to the correct value.
           
  origin =   File "/home/taurel/.local/lib/python2.7/site-packages/tango/device_class.py", line 553, in __DeviceClass__device_factory
    device = self._new_device(deviceImplClass, klass, dev_name)
  File "/home/taurel/.local/lib/python2.7/site-packages/tango/device_class.py", line 533, in __DeviceClass__new_device
    return klass(dev_class, dev_name)
  File "/home/taurel/.local/lib/python2.7/site-packages/tango_simlib/sim_test_interface.py", line 35, in __init__
    super(TangoTestDeviceServerBase, self).__init__(dev_class, name)
  File "/home/taurel/.local/lib/python2.7/site-packages/tango/server.py", line 551, in __init__
    self.init_device()
  File "/home/taurel/.local/lib/python2.7/site-packages/tango/server.py", line 349, in init_device
    return get_worker().execute(init_device_orig, self)
  File "/home/taurel/.local/lib/python2.7/site-packages/tango/server.py", line 1498, in execute
    return func(*args, **kwargs)
  File "/home/taurel/.local/lib/python2.7/site-packages/tango_simlib/tango_sim_generator.py", line 311, in init_device
    super(SimControl, self).init_device()
  File "/home/taurel/.local/lib/python2.7/site-packages/tango/server.py", line 349, in init_device
    return get_worker().execute(init_device_orig, self)
  File "/home/taurel/.local/lib/python2.7/site-packages/tango/server.py", line 1498, in execute
    return func(*args, **kwargs)
  File "/home/taurel/.local/lib/python2.7/site-packages/tango_simlib/sim_test_interface.py", line 54, in init_device
    'correct value.'.format(self.model_key))

  reason = PyDs_PythonError
severity = ERR]
]

Exited

I do not understand the reason of my problem. The model_key property
is defined to "et/weather/01" which is my Weather class device name.
Any idea of what could be the reason of this exception?

Please note that if I do not have any device of the simulation control
class, the DS starts correctly.

Thank's in advance for your answer

Emmanuel

Hi Manu

Sorry to hear that. I have tried to reproduce the error and it seems like this only happens when you start your DS with the command:
./Weather manu
. The DS (both the sim device and sim control device) starts up when you run it with:
python Weather manu
.


Kind regards,
K. Madisa


Hi,

I agree, the DS now starts but I do not really understand. The first line of the generated code is the usual

#!/usr/bin/env python

and therefore, executing the file should be enough. Is there something I miss here?

Regards

Emmanuel
Hi Manu,

The DS is supposed to start when you run:
./Weather manu
The reason why it is raising the exception is the way we are processing the command line arguments in the helper_module.py:
 
executable_name = os.path.split(sys.argv[0].split('.')[0])[1]
server_name = executable_name + '/' + sys.argv[1]                                                                
return server_name    
This results in the wrong server name being returned, in this case:

server_name == '/manu'

Which, in short, results in the model having the default_name 'test/nodb/tangodeviceserver'

db_datum = db_instance.get_device_name(server_name, klass_name)                         
# We assume that at least one device instance has been                                  
# registered for that class and device server.                                          
dev_names = getattr(db_datum, 'value_string')                                                          
if dev_names:                                                                           
    dev_name = dev_names[0]                                                             
else:                                                                                   
    # In case a device name is not provided during testing a                            
    # default name is assigned since it cannot be found in database.                    
    dev_name = 'test/nodb/tangodeviceserver'
Which means when the sim control device tries to look up the model that matches the name in the device property ("et/weather/01") it does not find it and therefore raises the RuntimeError.

The team has fixed that and the new changes have been merged into the master branch.

We appreciate your valuable feedback and hope you will let us know if you face any problems when using the package.

Kind regards,
K. Madisa



 
Register or login to create to post a reply.