selinon.data_storage module

Data storage interface.

class selinon.data_storage.DataStorage(*args, **kwargs)[source]

Bases: object

Abstract Selinon storage adapter that is implemented by a user.

connect()[source]

Connect to a resource, if not needed, should be empty.

disconnect()[source]

Disconnect from a resource.

is_connected()[source]

Check storage connection status.

Returns:True if connected to a resource
retrieve(flow_name, task_name, task_id)[source]

Retrieve result stored in storage.

Parameters:
  • flow_name – flow name in which task was executed
  • task_name – task name that result is going to be retrieved
  • task_id – id of the task that result is going to be retrieved
Returns:

task result

store(node_args, flow_name, task_name, task_id, result)[source]

Store result stored in storage.

Parameters:
  • node_args – arguments that were passed to node
  • flow_name – flow name in which task was executed
  • task_name – task name that result is going to be stored
  • task_id – id of the task that result is going to be stored
  • result – result that should be stored
Returns:

unique ID of stored record

store_error(node_args, flow_name, task_name, task_id, exc_info)[source]

Store information about task error.

Parameters:
  • node_args – arguments that were passed to node
  • flow_name – flow name in which task was executed
  • task_name – task name that result is going to be stored
  • task_id – id of the task that result is going to be stored
  • exc_info – information about exception - tuple (type, value, traceback) as returned by sys.exc_info()
Returns:

unique ID of stored record