TangoFactory

Inheritance diagram of TangoFactory
class TangoFactory[source]

Bases: taurus.core.util.singleton.Singleton, taurus.core.taurusfactory.TaurusFactory, taurus.core.util.log.Logger

A TaurusFactory singleton class to provide Tango-specific Taurus Element objects (TangoAuthority, TangoDevice, TangoAttribute)

Tango model names are URI based See https://tools.ietf.org/html/rfc3986. For example, a TangoAttribute would be:

tango://foo.org:1234/a/b/c/d#label
\___/   \_____/ \__/ \_____/ \___/
  |        |     |      |      |
  |    hostname port  attr     |
  |   \____________/\______/   |
  |         |           |      |
scheme   authority     path  fragment

For Tango Elements:

  • The ‘scheme’ must be the string “tango” (lowercase mandatory)
  • The ‘authority’ identifies the Tango database (<hostname> and <port> are mandatory if authority is given)
  • The ‘path’ identifies Tango Device and Attributes. For devices it must have the format _/_/_ or alias For attributes it must have the format _/_/_/_ or devalias/_
  • The ‘fragment’ is optional and it refers to a member of the model object, thus not being part of the model name itself
caseSensitive = False
cleanUp()[source]

Cleanup the singleton instance

disablePolling()[source]

Disable the application tango polling

elementTypesMap = {18: <class 'taurus.core.tango.tangodatabase.TangoAuthority'>, 3: <class 'taurus.core.tango.tangodevice.TangoDevice'>, 13: <class 'taurus.core.tango.tangoattribute.TangoAttribute'>}
enablePolling()[source]

Enable the application tango polling

getAttribute(attr_name, create_if_needed=True, **kwargs)[source]

Obtain the object corresponding to the given attribute name. If the corresponding attribute already exists, the existing instance is returned. Otherwise a new instance is stored and returned.

Parameters:
  • attr_name (str) – a valid attribute name URI
  • create_if_needed (bool) – If True, the Attribute is created if it did not already exist. If False, None is returned if it did not exist
Return type:

TangoAttribute

Returns:

attribute object

Raise:

(TaurusException) if the given alias is invalid.

getAttributeInfo(full_attr_name)[source]

Deprecated: Use taurus.core.tango.TangoFactory.getConfiguration() instead.

Obtain attribute information corresponding to the given attribute name. If the corresponding attribute info already exists, the existing information is returned. Otherwise a new information instance is stored and returned.

Parameters:full_attr_name (str) – attribute name in format: <tango device name>’/’<attribute name>
Return type:TangoConfiguration
Returns:configuration object
getAttributeNameValidator()[source]

Return TangoAttributeNameValidator

getAuthority(name=None)[source]

Obtain the object corresponding to the given database name or the default database if name is None. If the corresponding authority object already exists, the existing instance is returned. Otherwise a new instance is stored and returned.

Parameters:name (str) – database name string alias. If None, the default database is used
Return type:TangoAuthority
Returns:database object
Raise:(TaurusException) if the given alias is invalid.
getAuthorityNameValidator()[source]

Return TangoAuthorityNameValidator

getConfiguration(*args, **kwargs)
Obtain the object corresponding to the given attribute or full name.

If the corresponding configuration already exists, the existing instance is returned. Otherwise a new instance is stored and returned.

type param:TaurusAttribute or str
param param:attribute object or full configuration name
rtype:TangoAttribute
return:configuration object

Deprecated since version 4.0: Use getAttribute instead

getDatabase(name=None)[source]

Deprecated. Use getAuthority instead

getDatabaseNameValidator()[source]

Deprecated

getDevice(dev_name, create_if_needed=True, **kw)[source]

Obtain the object corresponding to the given tango device name. If the corresponding device already exists, the existing instance is returned. Otherwise a new instance is stored and returned.

Parameters:
  • dev_name (str) – tango device name or tango alias for the device. It must be a valid Tango device URI. If authority is not explicit, the default Tango Database will be used
  • create_if_needed (bool) – If True, the Device is created if it did not exist previously. If False, it returns None if it did not exist
Return type:

TangoDevice

Returns:

a device object

Raise:

(TaurusException) if the given dev_name is invalid.

getDeviceNameValidator()[source]

Return TangoDeviceNameValidator

getExistingAttribute(attr_name)[source]

Deprecated: use getAtribute with create_if_needed=False

getExistingAttributes()[source]

Returns a new dictionary will all registered attributes on this factory

Returns:dictionary will all registered attributes on this factory
Return type:dict
getExistingDatabases()[source]

Returns a new dictionary will all registered databases on this factory

Returns:dictionary will all registered databases on this factory
Return type:dict
getExistingDevice(dev_name)[source]

Deprecated: use getDevice with create_if_needed=False

getExistingDevices()[source]

Returns a new dictionary will all registered devices on this factory

Returns:dictionary will all registered devices on this factory
Return type:dict
getOperationMode()[source]

Deprecated. Gives the current operation mode.

get_default_tango_host()[source]

Retruns the current default tango host

init(*args, **kwargs)[source]

Singleton instance initialization. For internal usage only

isPollingEnabled()[source]

Tells if the local tango polling is enabled

Return type:bool
Returns:wheter or not the polling is enabled
is_tango_subscribe_enabled()[source]

Returns the current tango_subscribe_enabled status

Warning

This method belongs to a “Delayed Event Subscription” API added in v.4.2.1-alpha as an experimental feature. This API may not be stable and/or it may be removed in a future release (even on a minor version change)

reInit()[source]

Reinitialize the singleton

registerAttributeClass(attr_name, attr_klass)[source]

Registers a new attribute class for the attribute name.

Parameters:
  • attr_name (str) – attribute name
  • attr_klass (TangoAttribute) – the new class that will handle the attribute
registerDeviceClass(dev_klass_name, dev_klass)[source]

Registers a new python class to handle tango devices of the given tango class name

Parameters:
  • dev_klass_name (str) – tango device class name
  • dev_klass (TangoDevice) – the new class that will handle devices of the given tango class name
removeExistingAttribute(attr_or_attr_name)[source]

Removes a previously registered attribute.

Parameters:attr_or_attr_name (str or TangoAttribute) – attribute name or attribute object
removeExistingDevice(dev_or_dev_name)[source]

Removes a previously registered device.

Parameters:dev_or_dev_name (str or TangoDevice) – device name or device object
schemes = ('tango',)

the list of schemes that this factory supports. For this factory: ‘tango’ is the only scheme

setOperationMode(mode)[source]

Deprecated. setOperationMode(OperationMode mode) -> None Sets the operation mode for the Tango system.

set_default_tango_host(tango_host)[source]

Sets the new default tango host. The method will transform the given name to an Authority URI.

Note

Calling this method also clears the device alias cache.

Parameters:tango_host (str) – the new tango host. It accepts any valid Tango authority name or None to use the defined by $TANGO_HOST env. var.
set_tango_subscribe_enabled(value)[source]

If True, enables event subscribing on TangoAttribute objects

Warning

This method belongs to a “Delayed Event Subscription” API added in v.4.2.1-alpha as an experimental feature. This API may not be stable and/or it may be removed in a future release (even on a minor version change)

unregisterAttributeClass(attr_name)[source]

Unregisters the attribute class for the given attribute If no class was registered before for the given attribute, this call as no effect

Parameters:attr_name (str) – attribute name
unregisterDeviceClass(dev_klass_name)[source]

Unregisters the class for the given tango class name If no class was registered before for the given attribute, this call as no effect

Parameters:dev_klass_name (str) – tango device class name