Green API#
- Summary:
- tango.set_green_mode(green_mode: GreenMode = None)[source]#
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
- tango.asyncio.DeviceProxy(self, dev_name: str, wait: bool = False, timeout: float = None) DeviceProxy#
- tango.asyncio.DeviceProxy(self, dev_name: str, need_check_acc: bool, wait: bool = False, timeout: float = None) DeviceProxy
Creates a asyncio enabled
DeviceProxy.The DeviceProxy constructor internally makes some network calls which makes it slow. By using the asyncio green mode you may give the control back to the asyncio event loop using the yield from or await synthax.
Note
The timeout parameter has no relation with the tango device client side timeout (gettable by
get_timeout_millis()and settable throughset_timeout_millis())- Parameters:
dev_name (str) – the device name or alias
need_check_acc (bool) – (optional, default is 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:
- Throws:
DevFailedif wait is True and there is an error creating the device.asyncio.TimeoutErrorif wait is False, timeout is not None and the time to create the device has expired.
Added in version 8.1.0.
- tango.asyncio.AttributeProxy(self, full_attr_name: str, wait: bool = False, timeout: float = None) AttributeProxy#
- tango.asyncio.AttributeProxy(self, device_proxy: DeviceProxy, attr_name: str, wait: bool = False, timeout: float = None) AttributeProxy
Creates a futures enabled
AttributeProxy.The AttributeProxy constructor internally makes some network calls which makes it slow. By using the asyncio green mode you may give the control back to the asyncio event loop using the yield from or await synthax.
- Parameters:
full_attr_name (str) – the full name of the attribute
device_proxy (DeviceProxy) – the
DeviceProxyattr_name (str) – attribute name for the given device proxy
wait (bool) – whether or not to wait for result of creating an AttributeProxy.
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:
AttributeProxy- else:
- Throws:
DevFailedif wait is True and there is an error creating the attribute.asyncio.TimeoutErrorif wait is False, timeout is not None and the time to create the attribute has expired.
Added in version 8.1.0.
- tango.futures.DeviceProxy(self, dev_name: str, wait: bool = False, timeout: float = None) DeviceProxy#
- tango.futures.DeviceProxy(self, dev_name: str, need_check_acc: bool, wait: bool = False, timeout: float = None) 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 throughset_timeout_millis())- Parameters:
dev_name (str) – the device name or alias
need_check_acc (bool) – (optional, default is 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:
- else:
- Throws:
DevFailedif wait is True and there is an error creating the device.concurrent.futures.TimeoutErrorif wait is False, timeout is not Noneand the time to create the device has expired.
Added in version 8.1.0.
- tango.futures.AttributeProxy(self, full_attr_name: str, wait: bool = False, timeout: float = None) AttributeProxy#
- tango.futures.AttributeProxy(self, device_proxy: DeviceProxy, attr_name: str, wait: bool = False, timeout: float = None) AttributeProxy
Creates a futures enabled
AttributeProxy.The AttributeProxy constructor internally makes some network calls which makes it slow. By using the gevent mode you are allowing other python code to be executed in a cooperative way.
- Parameters:
full_attr_name (str) – the full name of the attribute
device_proxy (DeviceProxy) – the
DeviceProxyattr_name (str) – attribute name for the given device proxy
wait (bool) – whether or not to wait for result of creating an AttributeProxy.
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:
- else:
- Throws:
DevFailedif wait is True and there is an error creating the attribute.concurrent.futures.TimeoutErrorif wait is False, timeout is not Noneand the time to create the attribute has expired.
Added in version 8.1.0.
- tango.gevent.DeviceProxy(self, dev_name: str, wait: bool = False, timeout: float = None) DeviceProxy#
- tango.gevent.DeviceProxy(self, dev_name: str, need_check_acc: bool, wait: bool = False, timeout: float = None) 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 throughset_timeout_millis())- Parameters:
dev_name (str) – the device name or alias
need_check_acc (bool) – (optional, default is 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:
- else:
gevent.event.AsynchResult
- Throws:
DevFailedif wait is True and there is an error creating the devicegevent.timeout.Timeoutif wait is False, timeout is not Noneand the time to create the device has expired.
Added in version 8.1.0.
- tango.gevent.AttributeProxy(self, full_attr_name: str, wait: bool = False, timeout: float = None) AttributeProxy#
- tango.gevent.AttributeProxy(self, device_proxy: DeviceProxy, attr_name: str, wait: bool = False, timeout: float = None) AttributeProxy
Creates a gevent enabled
AttributeProxy.The AttributeProxy constructor internally makes some network calls which makes it slow. By using the gevent mode you are allowing other python code to be executed in a cooperative way.
- Parameters:
full_attr_name (str) – the full name of the attribute
device_proxy (DeviceProxy) – the
DeviceProxyattr_name (str) – attribute name for the given device proxy
wait (bool) – whether or not to wait for result of creating an AttributeProxy.
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:
- else:
gevent.event.AsynchResult
- Throws:
DevFailedif wait is True and there is an error creating the attributegevent.timeout.Timeoutif wait is False, timeout is not None andthe time to create the attribute has expired.
Added in version 8.1.0.