How do I start a device server?

Hello everyone!
I developed a device server and made a shared library out of it. But I don't understand how to create an instance of it. Does it require some more steps? I am completely confused as there doesn't seem to be an obvious answer in the documentation.
Edited 5 years ago
Hi,

You can use jive for instance, to create an instance of your device server.
Please have a look at this part of the documentation:
https://tango-controls.readthedocs.io/en/latest/tools-and-extensions/built-in/jive/servers.html#manage-servers

tango_admin tool (–add-server option) can also help you to create a device server instance.


tango_admin –help

Usage:
 –help  		Prints this help
 –ping-database	[max_time (s)] Ping database
 –check-device <dev>    Check if the device is defined in DB
 –add-server <exec/inst> <class> <dev list (comma separated)>   Add a server in DB
 –delete-server <exec/inst> [–with-properties]   Delete a server from DB
 –check-server <exec/inst>   Check if a device server is defined in DB
 –server-list  Display list of server names
 –server-instance-list <exec>   Display list of server instances for the given server name
 –add-property <dev> <prop_name> <prop_value (comma separated for array)>    Add a device property in DB
 –delete-property <dev> <prop_name>   Delete a device property from DB
 –tac-enabled Check if the TAC (Tango Access Control) is enabled
 –ping-device <dev> [max_time (s)] Check if the device is running
 –ping-network [max_time (s)] [-v] Ping network
Rosenberg's Law: Software is easy to make, except when you want it to do something new.
Corollary: The only software that's worth making is software that does something new.
Hi,

First of all you need an executable not a shared library.

Tango device server is a process running on a machine, while the Tango device is a thread of that process.

Once you have executable you run it as any other program e.g. in linux:

$> TANGO_HOST=somehost:10000 ./MyTangoDevice dev


Note two things: the TANGO_HOST and the parameter.

For Tango device server to start it is essential to pass at least one parameter - server instance name.

If you do it right away you will get an error message that server/device is not defined in Tango database (TANGO_HOST env variable in front of the executable)

Now you need to use Jive or Waltz to define the server in the database. For instance, using Jive follow these steps:

  1. start jive
  2. Tools -> Server Wizard
  3. enter server name (this is typically the same as class name of your device e.g. MyDevice) and server instance name (must be the same as the parameter you pass to the executable)
  4. click next
  5. click next (wizard will fail to recognize server's class, we will add it later manually)
  6. exit from wizard (click Cancel, confirm)
  7. in server tree expand newly registered server
  8. right click on the server instance -> add class
  9. in Class enter MyDevice
  10. in Device enter dev/device/0
  11. click "Register server"
  12. refresh jive, no error messages should occur

With this easy steps you should be able to start your device. There is a how-to in the documentation: How to start a device server

OR as Reynald posted you can use tango_admin –add-server if it is installed on your system:


$> tango_admin –add-server MyDevice/dev MyDevice dev/device/0
Edited 5 years ago
Thank you for answers! Everything is working.
Hi,

I was wondering if you could let me know how to I create an executable for the device server. I'm going through the documentation but I haven't found anything explaining how to do so.

Thanks
Hi Eva,

What kind of device server executable would you like to create?
Do you have already the device server code? Do you want to create a new one?
Do you want to work with a pyTango device server (in Python), a C++ device server or a java device server?

Kind regards,
Reynald

Evaki
Hi,

I was wondering if you could let me know how to I create an executable for the device server. I'm going through the documentation but I haven't found anything explaining how to do so.

Thanks
Rosenberg's Law: Software is easy to make, except when you want it to do something new.
Corollary: The only software that's worth making is software that does something new.
Hello Reynald,

I am trying to follow the PyTango tutorial PowerSupply and I have the device server code for it.
I have registered the device in Jive and I try to start it via cmd I get this:

(.venv) C:\PythonProj\TTtest>python power_supply.py test
Unknown exception while trying to fill database cache…
Ready to accept request

In Astor the server is not running and when I click on Start the Server I get this error (also shown in the attachments):
PowerSupply : not found in 'StartDsPath' property:
- C:\DeviceServers\bin

In Jive when I try to test the drive I get the error also shown in the attachments

From what I have read I need an executable at the StartDSPath?

Thanks,
Eva
I think this other post will help you:
https://www.tango-controls.org/community/forum/c/development/python/python-and-astor/?page=1#post-142

Hoping this helps.
Reynald
Rosenberg's Law: Software is easy to make, except when you want it to do something new.
Corollary: The only software that's worth making is software that does something new.
I've read this but I don't understand it..
At the previous post it says create a file with no extension:

You have to create a file without extension PythonDS which contains :

#!/usr/bin/env python
# PythonDS device server launch script

from PythonDS import main

if __name__ == '__main__':
main()


and later on thay say to create a .bat file:

For your example :

PSDS.bat containing:

python c:/MyPath/PSDS.py %1 %2


Sorry, I am new to this and it is just confusing. Shouldn't I create an .exe file? and what should it contain?
Evaki
I've read this but I don't understand it..
At the previous post it says create a file with no extension:

You have to create a file without extension PythonDS which contains :

#!/usr/bin/env python
# PythonDS device server launch script

from PythonDS import main

if __name__ == '__main__':
main()

This was for the case when you are on Linux.

Evaki
and later on thay say to create a .bat file:

For your example :

PSDS.bat containing:

python c:/MyPath/PSDS.py %1 %2

The second one (.bat file) is for the case when you are on Windows.
Rosenberg's Law: Software is easy to make, except when you want it to do something new.
Corollary: The only software that's worth making is software that does something new.
Edited 4 years ago
 
Register or login to create to post a reply.