dragonfly.implementations.multido module

Some template vars

Members: MultiDo MultiGet MultiSet Functions: Classes:

Convenience object allowing a single target to interact with multiple endpoints

Summary

class dragonfly.implementations.multido.MultiDo(targets, set_condition_dict=None, **kwargs)

Bases: dragonfly.implementations.multido.MultiDo

MultiDo is a convenience object allowing a single target to interact with multiple endpoints. MultiDo serves as the generic implementation with both get and set methods, specific implementations of MultiGet or MultiSet will limit this functionality for particular use cases.

For get, the calibrated value returned is intended to be a nicely formatted string representation of the result, while the raw value will retain the types of those values returned. A “payload_field” should be specified for each target. Either a “formatter” or “units” specifier may be given for each target for further detailing the calibrated return value.

For set, each target can have a “default_set” or adopt the given value. The set_and_check feature is implemented, which can be bypassed with the “no_check” option, or loosened with a “tolerance” value. For endpoints requiring a separate endpoint to be checked, the “get_name” and “target_value” arguments are provided.

Keyword Arguments:
 
  • set_condition_dict (dict) – dict of set_condition # : set_value pairs
  • targets (list) – list of dictionaries which must provide a value for ‘target’, other optional fields: default_set: always set endpoint to this value payload_field (str): return payload field to get (value_cal, value_raw, or values) units (str): display units for ‘calibrated’ return value formatter (str): special formatting for ‘calibrated’ return string tolerance: check tolerance no_check (bool): disable set_and_check; necessary for set-only endpoints! get_target (str): endpoint to get for check (default is ‘target’) target_value: alternate value to check against get_only (bool): skip endpoint for set routine check_field (str): return payload field to check against (value_cal, value_raw, or values), if different from displayed get field
  • name (str) – unique identifier across all dripline services (used to determine routing key)
  • calibration (str||dict) – string use to process raw get result (with .format(raw)) or a dict to use for the same purpose where raw must be a key
  • get_on_set (bool) – flag to toggle running ‘on_get’ after each ‘on_set’

set_condition_dict (dict): dict of set_condition # : set_value pairs targets (list): list of dictionaries which must provide a value for ‘target’, other optional fields:

default_set: always set endpoint to this value payload_field (str): return payload field to get (value_cal, value_raw, or values) units (str): display units for ‘calibrated’ return value formatter (str): special formatting for ‘calibrated’ return string tolerance: check tolerance no_check (bool): disable set_and_check; necessary for set-only endpoints! get_target (str): endpoint to get for check (default is ‘target’) target_value: alternate value to check against get_only (bool): skip endpoint for set routine check_field (str): return payload field to check against (value_cal, value_raw, or values), if different from displayed get field
handle_request(channel, method, properties, request)
is_locked
lock(lockout_key=None, *args, **kwargs)
lockout_key
on_cmd(*args, **kwargs)

WARNING! if you override this method, you must ensure you deal with lockout properly

on_config(attribute, value=None)

configure a property again

WARNING! if you override this method, you must ensure you deal with lockout properly

on_get()

attemps to get a single endpoint and return value and string representation for every target

on_set(value)

Performs sets and checks … #TODO_DOC

ping(*args, **kwargs)

ignore all details and respond with an empty message

set_condition(*args, **kwargs)

To actually do something inside a class, the set_condition should be implemented in the class itself.

unlock(*args, **kwargs)
class dragonfly.implementations.multido.MultiGet(**kwargs)

Bases: dragonfly.implementations.multido.MultiGet

Identical to MultiDo, but with an explicit exception if on_set is attempted.

Keyword Arguments:
 
  • set_condition_dict (dict) – dict of set_condition # : set_value pairs
  • targets (list) – list of dictionaries which must provide a value for ‘target’, other optional fields: default_set: always set endpoint to this value payload_field (str): return payload field to get (value_cal, value_raw, or values) units (str): display units for ‘calibrated’ return value formatter (str): special formatting for ‘calibrated’ return string tolerance: check tolerance no_check (bool): disable set_and_check; necessary for set-only endpoints! get_target (str): endpoint to get for check (default is ‘target’) target_value: alternate value to check against get_only (bool): skip endpoint for set routine check_field (str): return payload field to check against (value_cal, value_raw, or values), if different from displayed get field
  • name (str) – unique identifier across all dripline services (used to determine routing key)
  • calibration (str||dict) – string use to process raw get result (with .format(raw)) or a dict to use for the same purpose where raw must be a key
  • get_on_set (bool) – flag to toggle running ‘on_get’ after each ‘on_set’
handle_request(channel, method, properties, request)
is_locked
lock(lockout_key=None, *args, **kwargs)
lockout_key
on_cmd(*args, **kwargs)

WARNING! if you override this method, you must ensure you deal with lockout properly

on_config(attribute, value=None)

configure a property again

WARNING! if you override this method, you must ensure you deal with lockout properly

on_get()

attemps to get a single endpoint and return value and string representation for every target

on_set(value)

Performs sets and checks … #TODO_DOC

ping(*args, **kwargs)

ignore all details and respond with an empty message

set_condition(*args, **kwargs)

To actually do something inside a class, the set_condition should be implemented in the class itself.

unlock(*args, **kwargs)
class dragonfly.implementations.multido.MultiSet(**kwargs)

Bases: dragonfly.implementations.multido.MultiSet

Identical to MultiDo, but with an explicit exception if on_get is attempted and forced no_check on all targets. MultiDo’s on_get method has error handling, so this method only useful to globally apply no_check option.

Keyword Arguments:
 
  • set_condition_dict (dict) – dict of set_condition # : set_value pairs
  • targets (list) – list of dictionaries which must provide a value for ‘target’, other optional fields: default_set: always set endpoint to this value payload_field (str): return payload field to get (value_cal, value_raw, or values) units (str): display units for ‘calibrated’ return value formatter (str): special formatting for ‘calibrated’ return string tolerance: check tolerance no_check (bool): disable set_and_check; necessary for set-only endpoints! get_target (str): endpoint to get for check (default is ‘target’) target_value: alternate value to check against get_only (bool): skip endpoint for set routine check_field (str): return payload field to check against (value_cal, value_raw, or values), if different from displayed get field
  • name (str) – unique identifier across all dripline services (used to determine routing key)
  • calibration (str||dict) – string use to process raw get result (with .format(raw)) or a dict to use for the same purpose where raw must be a key
  • get_on_set (bool) – flag to toggle running ‘on_get’ after each ‘on_set’
handle_request(channel, method, properties, request)
is_locked
lock(lockout_key=None, *args, **kwargs)
lockout_key
on_cmd(*args, **kwargs)

WARNING! if you override this method, you must ensure you deal with lockout properly

on_config(attribute, value=None)

configure a property again

WARNING! if you override this method, you must ensure you deal with lockout properly

on_get()

attemps to get a single endpoint and return value and string representation for every target

on_set(value)

Performs sets and checks … #TODO_DOC

ping(*args, **kwargs)

ignore all details and respond with an empty message

set_condition(*args, **kwargs)

To actually do something inside a class, the set_condition should be implemented in the class itself.

unlock(*args, **kwargs)

End of modules condition

Data:

End of data condition