Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • Each type of device has a collection that includes possible configurations for instances of this device.  The configurations are stored as typed JSON objects.
  • The configuration database includes a set of hutches, one collection per hutch.
  • Each hutch has a set of aliases, which describe a specific running condition (for example: "BEAM" or "NO_BEAM").
  • The hutch collection has a set of documents which include an alias, a version number (key), and a list of dictionaries (one per device).  These dictionaries include the name of the instance of the device, the device type, and an ID which identifies the particular configuration document in the device type collection that should be used. The highest version number for a particular alias is the current configuration for this alias.

...

  • server is a string identifying the MongoDB server and is either "user:password@host:port" or "host:port".
  • h is a string identifying the the default hutch.
  • If create is True, create any necessary DB entries.
  • root is the name of the database to use.  The DAQ configuration will be kept in "configDB".

The methods in the configdb class are:

  • set_hutch(h, create=False)
    Set the default hutch to h.  If create is True, create any necessary DB entries.
  • add_alias(alias)
    Add a new alias to the default hutch.
  • add_device_config(cfg)
    Add a new device type collection named cfg.
  • get_hutches()
    Return a list of all defined hutches.
  • get_aliases(hutch=None)
    Return a list of all aliases for the specified hutch (or the default hutch if the parameter is None).
  • get_device_configs()
    Return a list of all device types.
  • get_key(alias, hutch=None)
    Return the highest version number for the alias in the specified hutch (or default hutch if None).
  • get_devices(key_or_alias, hutch=None)
    Return a list of devices in the specified hutch (or default hutch if None).  key_or_alias specifies the particular configuration to examine:  if it is a string, use the current configuration for this alias and if it is an integer, use the configuration with the specified version number.
  • modify_device(alias, value, hutch=None)
    Modify the current configuration for the specified alias in the specified hutch.  value is a typed JSON dictionary where the detName:RO field is the name of the device and detType:RO is the device type.  This raises an exception if there is an error and returns the newly written version number otherwise.
  • get_configuration(key_or_alias, device, hutch=None)
    Get the configuration for the specified device in the specified hutch (or the default if this is None).  key_or_alias specifies the particular configuration to examine:  if it is a string, use the current configuration for this alias and if it is an integer, use the configuration with the specified version number.
  • transfer_config(oldhutch, oldalias, olddevice, newalias, newdevice)
  • get_history(alias, device, plist, hutch=None)