51Degrees Pipeline for Python

fiftyone_pipeline_core.flowdata.FlowData Class Reference

Detailed Description

FlowData is created by a specific Pipeline It collects evidence set by the user It passes evidence to FlowElements in the Pipeline These elements can return ElementData or populate an errors object.

Public Member Functions

 __init__ (self, pipeline)
 FlowData constructor.
 process (self)
 Runs the process function on every attached flowElement allowing data to be changed based on evidence.
 close (self)
 Release the native resources held by the element data in this FlowData, such as the results of an on-premise engine, which keep the engine's data in memory until they are released.
 __enter__ (self)
 __exit__ (self, exc_type, exc_value, exc_traceback)
 get_from_element (self, flow_element)
 Retrieve data by FlowElement object.
 get (self, flow_element_key)
 Retrieve data by flowElement key.
 __getattr__ (self, flow_element_key)
 Magic getter to allow retrieval of data from FlowData.data[flowElementKey] by flowElement name.
 __getitem__ (self, flow_element_key)
 Magic method in Python, which when used in a class, allows its instances to use the [] (indexer) operators.
 set_element_data (self, element_data)
 Set data (used by flowElement) within FlowData.data.
 set_error (self, flow_error)
 Set error (should be keyed by flowElement datakey).
 get_evidence_datakey (self)
 Get a list of evidence stored in the flowdata, filtered by its flowElements' evidenceKeyFilters.
 stop (self)
 Stop processing any subsequent flowElements.
 get_where (self, metakey, metavalue)
 Get data from flowElement based on property meta data.

Public Attributes

dict data = {}
dict errors = {}
 pipeline = pipeline
bool processed = False
bool stopped = False
 evidence = Evidence(self)

Constructor & Destructor Documentation

◆ __init__()

fiftyone_pipeline_core.flowdata.FlowData.__init__ ( self,
pipeline )

FlowData constructor.

@type pipeline: Pipeline

Parameters
pipelineparent pipeline

Member Function Documentation

◆ __enter__()

fiftyone_pipeline_core.flowdata.FlowData.__enter__ ( self)

◆ __exit__()

fiftyone_pipeline_core.flowdata.FlowData.__exit__ ( self,
exc_type,
exc_value,
exc_traceback )

◆ __getattr__()

fiftyone_pipeline_core.flowdata.FlowData.__getattr__ ( self,
flow_element_key )

Magic getter to allow retrieval of data from FlowData.data[flowElementKey] by flowElement name.

For example, instead of flowdata.get("device") you can use flowdata.device

@type flow_element_key: string

Parameters
flow_element_keydatakey of the FlowElement that created the data of interest

@rtype: ElementData

◆ __getitem__()

fiftyone_pipeline_core.flowdata.FlowData.__getitem__ ( self,
flow_element_key )

Magic method in Python, which when used in a class, allows its instances to use the [] (indexer) operators.

For example, instead of flowdata.get("device") you can use flowdata["device"]

@type flow_element_key: string

Parameters
flow_element_keydatakey of the FlowElement that created the data of interest

@rtype: ElementData

◆ close()

fiftyone_pipeline_core.flowdata.FlowData.close ( self)

Release the native resources held by the element data in this FlowData, such as the results of an on-premise engine, which keep the engine's data in memory until they are released.

Use a with statement so that this happens as soon as the FlowData is finished with, rather than when the garbage collector next runs.

Only element data with a close method of its own is closed, so element data that needs no cleanup, such as an entry in a results cache, is left alone. Values already read are unaffected.

◆ get()

fiftyone_pipeline_core.flowdata.FlowData.get ( self,
flow_element_key )

Retrieve data by flowElement key.

Called by FlowData.get_from_element method.

@type flow_element_key: string

Parameters
flow_element_keyFlowElement.datakey of the FlowElement that created the data of interest

@rtype: ElementData

Returns
: Returns data in the FlowData instance that is under the specified key

◆ get_evidence_datakey()

fiftyone_pipeline_core.flowdata.FlowData.get_evidence_datakey ( self)

Get a list of evidence stored in the flowdata, filtered by its flowElements' evidenceKeyFilters.

@rtype: list

Returns
: Returns filtered evidence

◆ get_from_element()

fiftyone_pipeline_core.flowdata.FlowData.get_from_element ( self,
flow_element )

Retrieve data by FlowElement object.

@type flow_element: FlowElement

Parameters
flow_elementFlowElement that created the data of interest

@rtype: ElementData

Returns
: Returns data that was created by the flowElement held in the FlowData

◆ get_where()

fiftyone_pipeline_core.flowdata.FlowData.get_where ( self,
metakey,
metavalue )

Get data from flowElement based on property meta data.

@type metakey: str

Parameters
metakeymetakey shared by all data of interest

@type metavalue: mixed

Parameters
metavaluemeta value shared by all data of interest

@rtype: dict

Returns
: Returns dictionary of data created by the flowElement that have the specified meta property

◆ process()

fiftyone_pipeline_core.flowdata.FlowData.process ( self)

Runs the process function on every attached flowElement allowing data to be changed based on evidence.

This can only be run once per FlowData instance.

@rtype: FlowData

Returns
: Returns flowdata

◆ set_element_data()

fiftyone_pipeline_core.flowdata.FlowData.set_element_data ( self,
element_data )

Set data (used by flowElement) within FlowData.data.

@type element_data: ElementData

Parameters
element_dataelementData to be added to flowdata

◆ set_error()

fiftyone_pipeline_core.flowdata.FlowData.set_error ( self,
flow_error )

Set error (should be keyed by flowElement datakey).

@type error: FlowError

Parameters
errorFlow Error

◆ stop()

fiftyone_pipeline_core.flowdata.FlowData.stop ( self)

Stop processing any subsequent flowElements.

Returns
void

Member Data Documentation

◆ data

dict fiftyone_pipeline_core.flowdata.FlowData.data = {}

◆ errors

dict fiftyone_pipeline_core.flowdata.FlowData.errors = {}

◆ evidence

fiftyone_pipeline_core.flowdata.FlowData.evidence = Evidence(self)

◆ pipeline

fiftyone_pipeline_core.flowdata.FlowData.pipeline = pipeline

◆ processed

bool fiftyone_pipeline_core.flowdata.FlowData.processed = False

◆ stopped

bool fiftyone_pipeline_core.flowdata.FlowData.stopped = False