Green API

Summary:
PyTango.get_green_mode()

Returns the current global default PyTango green mode.

Returns:the current global default PyTango green mode
Return type:GreenMode
PyTango.set_green_mode(green_mode=None)

Sets the global default PyTango green mode.

Advice: Use only in your final application. Don’t use this in a python library in order not to interfere with the beavior of other libraries and/or application where your library is being.

Parameters:green_mode (GreenMode) – the new global default PyTango green mode
PyTango.futures.DeviceProxy(self, dev_name, wait=True, timeout=True) → DeviceProxy

DeviceProxy(self, dev_name, need_check_acc, wait=True, timeout=True) -> DeviceProxy

Creates a futures enabled DeviceProxy.

The DeviceProxy constructor internally makes some network calls which makes it slow. By using the futures green mode you are allowing other python code to be executed in a cooperative way.

Note

The timeout parameter has no relation with the tango device client side timeout (gettable by get_timeout_millis() and settable through set_timeout_millis())

Parameters:
  • dev_name (str) – the device name or alias
  • need_check_acc (bool) – in first version of the function it defaults to True. Determines if at creation time of DeviceProxy it should check for channel access (rarely used)
  • wait (bool) – whether or not to wait for result of creating a DeviceProxy.
  • timeout (float) – The number of seconds to wait for the result. If None, then there is no limit on the wait time. Ignored when wait is False.
Returns:

if wait is True:

DeviceProxy

else:

concurrent.futures.Future

Throws:
  • a DevFailed if wait is True and there is an error creating the device.
  • a concurrent.futures.TimeoutError if wait is False, timeout is not None and the time to create the device has expired.

New in PyTango 8.1.0

PyTango.gevent.DeviceProxy(self, dev_name, wait=True, timeout=True) → DeviceProxy

DeviceProxy(self, dev_name, need_check_acc, wait=True, timeout=True) -> DeviceProxy

Creates a gevent enabled DeviceProxy.

The DeviceProxy constructor internally makes some network calls which makes it slow. By using the gevent green mode you are allowing other python code to be executed in a cooperative way.

Note

The timeout parameter has no relation with the tango device client side timeout (gettable by get_timeout_millis() and settable through set_timeout_millis())

Parameters:
  • dev_name (str) – the device name or alias
  • need_check_acc (bool) – in first version of the function it defaults to True. Determines if at creation time of DeviceProxy it should check for channel access (rarely used)
  • wait (bool) – whether or not to wait for result of creating a DeviceProxy.
  • timeout (float) – The number of seconds to wait for the result. If None, then there is no limit on the wait time. Ignored when wait is False.
Returns:

if wait is True:

DeviceProxy

else:

gevent.event.AsynchResult

Throws:
  • a DevFailed if wait is True and there is an error creating the device.
  • a gevent.timeout.Timeout if wait is False, timeout is not None and the time to create the device has expired.

New in PyTango 8.1.0