51Degrees Pipeline for Python

fiftyone_pipeline_core.pipeline.Pipeline Class Reference

Detailed Description

Pipeline holding a list of FlowElements for processing, can create FlowData that will be passed through these, collecting ElementData Should be constructed through the PipelineBuilder class.

Public Member Functions

 __init__ (self, flow_elements, logger=Logger(), suppress_process_exceptions=False, data_file_update_service=None, auto_close_elements=True)
 Pipeline constructor.
 create_flowdata (self)
 Create a FlowData based on what's in the pipeline.
 close (self)
 Close the flow elements, which releases the native data they hold and stops the updates of their data files, unless the pipeline was built with auto_close_elements set to false.
 __enter__ (self)
 __exit__ (self, exc_type, exc_value, exc_traceback)
 log (self, level, message)
 Log a message using the Logger.log of the pipeline's Logger.
 get_element (self, key)
 Get a flowElement by its name.
 element_not_found (self, element, flowdata)
 Trigger error when an element cannot be found in the pipeline.
 get_properties (self)
 Get all properties of all flowElements in the pipeline.

Public Attributes

 flow_elements = flow_elements
 logger = logger
dict flow_elements_list = {}
list flow_elements_display_list = []
 suppress_process_exceptions = suppress_process_exceptions
 auto_close_elements = auto_close_elements
 data_file_update_service = data_file_update_service

Constructor & Destructor Documentation

◆ __init__()

fiftyone_pipeline_core.pipeline.Pipeline.__init__ ( self,
flow_elements,
logger = Logger(),
suppress_process_exceptions = False,
data_file_update_service = None,
auto_close_elements = True )

Pipeline constructor.

@type flow_elements: list[FlowElement]

Parameters
flow_elementsA list of flowElements

@type logger: Logger

Parameters
loggerA logger to attach to the pipeline

@type suppress_process_exceptions: boolean

Parameters
suppress_process_exceptionsIf true then pipeline will suppress exceptions added to FlowData.errors otherwise will throw the exception occurred during the processing of first element.

@type auto_close_elements: boolean

Parameters
auto_close_elementsIf true, the default, closing the pipeline closes its flow elements. Set it to false when the elements are shared with another pipeline, and close each element once every pipeline using it is finished with.

@rtype: Pipeline

Returns
: Returns a Pipeline

Member Function Documentation

◆ __enter__()

fiftyone_pipeline_core.pipeline.Pipeline.__enter__ ( self)

◆ __exit__()

fiftyone_pipeline_core.pipeline.Pipeline.__exit__ ( self,
exc_type,
exc_value,
exc_traceback )

◆ close()

fiftyone_pipeline_core.pipeline.Pipeline.close ( self)

Close the flow elements, which releases the native data they hold and stops the updates of their data files, unless the pipeline was built with auto_close_elements set to false.

Use a with statement so that this happens when the pipeline is finished with.

FlowData created by the pipeline are not closed by it. Close each one as well, because the results it holds keep the engine's data in memory until they are released.

◆ create_flowdata()

fiftyone_pipeline_core.pipeline.Pipeline.create_flowdata ( self)

Create a FlowData based on what's in the pipeline.

@rtype: FlowData

Returns
: Return a FlowData

◆ element_not_found()

fiftyone_pipeline_core.pipeline.Pipeline.element_not_found ( self,
element,
flowdata )

Trigger error when an element cannot be found in the pipeline.

@type element: string

Parameters
elementname of flowelement @type flowdata: flowdata
elementflowdata being processsed @rtype: Exception
Returns
: Returns exception

◆ get_element()

fiftyone_pipeline_core.pipeline.Pipeline.get_element ( self,
key )

Get a flowElement by its name.

@type key: string

Parameters
keyname of flowElement

@rtype: FlowElement

Returns
: Returns the FlowElement indicated

◆ get_properties()

fiftyone_pipeline_core.pipeline.Pipeline.get_properties ( self)

Get all properties of all flowElements in the pipeline.

@rtype: dict of {string : DataPropertyDictionary}

Returns
: Returns dictionary of all properties in a pipeline keyed by each flowElement's FlowElement.datakey.

◆ log()

fiftyone_pipeline_core.pipeline.Pipeline.log ( self,
level,
message )

Log a message using the Logger.log of the pipeline's Logger.

@type level: string

Parameters
levellevel of log message

@type message: string

Parameters
messageReturns content of log message

Member Data Documentation

◆ auto_close_elements

fiftyone_pipeline_core.pipeline.Pipeline.auto_close_elements = auto_close_elements

◆ data_file_update_service

fiftyone_pipeline_core.pipeline.Pipeline.data_file_update_service = data_file_update_service

◆ flow_elements

fiftyone_pipeline_core.pipeline.Pipeline.flow_elements = flow_elements

◆ flow_elements_display_list

list fiftyone_pipeline_core.pipeline.Pipeline.flow_elements_display_list = []

◆ flow_elements_list

dict fiftyone_pipeline_core.pipeline.Pipeline.flow_elements_list = {}

◆ logger

fiftyone_pipeline_core.pipeline.Pipeline.logger = logger

◆ suppress_process_exceptions

fiftyone_pipeline_core.pipeline.Pipeline.suppress_process_exceptions = suppress_process_exceptions