DeviceProxy on different hosts

How can I create two DeviceProxy, each one on different hosts?
Seems that i can do:

os.environ['TANGO_HOST'] = host1
db1 = tango.Database()
os.environ['TANGO_HOST'] = host2
db2 = tango.Database()

And this will give me the two databases, but I don't know how to to this for DeviceProxy.
Device proxy supports a tango device name in the form 'tango://<db host>:<db port>/<dev name>'

So you should be able to manage with something like this:

import tango

host1 = 'example1'
host2 = 'example2'

# Can also be set "manually"
db1 = tango.Database(host1, 10000)
db2 = tango.Database(host2, 10000)

dev1 = tango.DeviceProxy('tango://{}:10000/a/b/c'.format(host1))
dev1 = tango.DeviceProxy('tango://{}:10000/a/b/c'.format(host2))

hope it helps
Great! Thanks
Register or login to create to post a reply.