Detailed Description
A PipelineBuilder generates a Pipeline object Before construction of the Pipeline, FlowElements are added to it There are also options for how JavaScript is output from the Pipeline
Inheritance diagram for fiftyone_pipeline_core.pipelinebuilder.PipelineBuilder:
Collaboration diagram for fiftyone_pipeline_core.pipelinebuilder.PipelineBuilder:
Public Member Functions | |
| __init__ (self, settings={}) | |
| get_sequence_elements (self) | |
| get_javascript_elements (self) | |
| get_setheader_elements (self) | |
| add (self, flow_element) | |
| build (self) | |
| add_logger (self, logger) | |
| build_from_configuration (self, config) | |
Public Attributes | |
| list | flow_elements = [] |
| logger = Logger() | |
| bool | add_javaScriptbuilder = settings["add_javascript_builder"] |
| add_sequence_element = settings.get("add_sequence_element", True) | |
| add_json_builder_element | |
| add_javascript_builder_element | |
| add_set_header_element | |
| javascriptbuilder_settings = settings["javascript_builder_settings"] | |
| bool | use_setheader_properties = settings["use_setheader_properties"] |
| data_file_update_service = settings["data_file_update_service"] | |
| bool | suppress_process_exceptions = settings["suppress_process_exceptions"] |
| bool | auto_close_elements = settings["auto_close_elements"] |
Protected Member Functions | |
| _get_suppress_process_exceptions (self, config) | |
| _map_properties_names (self, mappings, arguments) | |
Constructor & Destructor Documentation
◆ __init__()
| fiftyone_pipeline_core.pipelinebuilder.PipelineBuilder.__init__ | ( | self, | |
| settings = {} ) |
Pipeline Builder constructor. @type settings: dictionary @param settings : settings for the pipeline builder including: `add_javascript_builder (Bool)` - Whether to add the JavaScriptBuilder, with the JSONBundler and SequenceElement it works with, to the pipeline (default true). Set to False to add none of the three. `add_sequence_element (Bool)` - Whether to add the SequenceElement, as the first element of the pipeline (default true) `add_json_builder_element (Bool)` - Whether to add the JSONBundler (default true). The JavaScriptBuilder reads its output, so a pipeline that keeps the JavaScriptBuilder needs a JSONBundler, added here or by the caller. `add_javascript_builder_element (Bool)` - Whether to add the JavaScriptBuilder alone (default true) `javascript_builder_settings (dict)` - Settings for the JavaScriptBuilder engine @rtype: PipelineBuilder `use_setheader_properties (Bool)` - Whether to add the SetHeaderElement to the pipeline (default true) `add_set_header_element (Bool)` - Whether to add the SetHeaderElement alone (default true). It is added only when this and use_setheader_properties are both true. `suppress_process_exceptions (Bool)` - If False (the default) the first error thrown while processing is re-raised from flow_data.process(); if True, errors are stored on flow_data.errors and process() returns normally. Recommended True for web apps so a processing failure degrades gracefully instead of failing the request. `auto_close_elements (Bool)` - Whether closing the pipeline closes its flow elements (default true). Set to False when the elements are shared with another pipeline, and close each element once every pipeline using it is finished with. @return: Returns a Pipeline Builder
Member Function Documentation
◆ _get_suppress_process_exceptions()
|
protected |
Resolve the suppress_process_exceptions setting from a configuration. Looks under 'PipelineOptions.BuildParameters' (mirrors the .NET/Java config layout for cross-language consistency), then a direct 'PipelineOptions' key, accepting either snake_case or camelCase, and finally falls back to the value supplied to the builder constructor (default False). @type config: dict @param config: pipeline configuration @rtype: bool @return: whether processing exceptions should be suppressed
◆ _map_properties_names()
|
protected |
◆ add()
| fiftyone_pipeline_core.pipelinebuilder.PipelineBuilder.add | ( | self, | |
| flow_element ) |
Add a flow_element to a list of flowElements be used in a pipeline. @type flow_element: FlowElement @param flow_element: flowElement to be added to the pipeline @rtype: PipelineBuilder @return: Returns the pipleine builder with the specified flowElement added to it's list of flowElements.
◆ add_logger()
| fiftyone_pipeline_core.pipelinebuilder.PipelineBuilder.add_logger | ( | self, | |
| logger ) |
Add an instance of the logger class to the pipeline. @type logger: Logger @param logger: Logger to be added to the pipeline @rtype: PipelineBuilder @return: Returns the pipeline builder with the specified Logger added.
◆ build()
| fiftyone_pipeline_core.pipelinebuilder.PipelineBuilder.build | ( | self | ) |
Construct an immutable Pipeline using the list of flowElements, (Engines) and (Logger) currently in this Pipeline Builder. Call build after all items to be included in the pipeline have been added. @rtype: Pipeline @return: Returns a Pipeline
◆ build_from_configuration()
| fiftyone_pipeline_core.pipelinebuilder.PipelineBuilder.build_from_configuration | ( | self, | |
| config ) |
Build a pipeline from a configuration file @type config: dict @param config: pipeline configuration @rtype: Pipeline @return: Returns built pipeline If an element fails to build, the elements already built are closed and the error is raised.
◆ get_javascript_elements()
| fiftyone_pipeline_core.pipelinebuilder.PipelineBuilder.get_javascript_elements | ( | self | ) |
The JSONBundler and the JavaScriptBuilder, to be added after the other elements. Neither is added if add_javascript_builder is false, and each has its own switch (add_json_builder_element and add_javascript_builder_element). @rtype: list @return: Returns a list of FlowElements
◆ get_sequence_elements()
| fiftyone_pipeline_core.pipelinebuilder.PipelineBuilder.get_sequence_elements | ( | self | ) |
The SequenceElement, to be the first element of the pipeline, unless add_javascript_builder or add_sequence_element is false @rtype: list @return: Returns a list of FlowElements
◆ get_setheader_elements()
| fiftyone_pipeline_core.pipelinebuilder.PipelineBuilder.get_setheader_elements | ( | self | ) |
Adds the SetHeaderElement to the pipeline if If use_setheader_properties and add_set_header_element are true (the default) @rtype: list @return: Returns a list of FlowElements
Member Data Documentation
◆ add_javascript_builder_element
| fiftyone_pipeline_core.pipelinebuilder.PipelineBuilder.add_javascript_builder_element |
Initial value:
= settings.get(
"add_javascript_builder_element", True)
◆ add_javaScriptbuilder
| fiftyone_pipeline_core.pipelinebuilder.PipelineBuilder.add_javaScriptbuilder = settings["add_javascript_builder"] |
◆ add_json_builder_element
| fiftyone_pipeline_core.pipelinebuilder.PipelineBuilder.add_json_builder_element |
Initial value:
= settings.get(
"add_json_builder_element", True)
◆ add_sequence_element
| fiftyone_pipeline_core.pipelinebuilder.PipelineBuilder.add_sequence_element = settings.get("add_sequence_element", True) |
◆ add_set_header_element
| fiftyone_pipeline_core.pipelinebuilder.PipelineBuilder.add_set_header_element |
Initial value:
= settings.get(
"add_set_header_element", True)
◆ auto_close_elements
| bool fiftyone_pipeline_core.pipelinebuilder.PipelineBuilder.auto_close_elements = settings["auto_close_elements"] |
◆ data_file_update_service
| fiftyone_pipeline_core.pipelinebuilder.PipelineBuilder.data_file_update_service = settings["data_file_update_service"] |
◆ flow_elements
| list fiftyone_pipeline_core.pipelinebuilder.PipelineBuilder.flow_elements = [] |
◆ javascriptbuilder_settings
| fiftyone_pipeline_core.pipelinebuilder.PipelineBuilder.javascriptbuilder_settings = settings["javascript_builder_settings"] |
◆ logger
| fiftyone_pipeline_core.pipelinebuilder.PipelineBuilder.logger = Logger() |
◆ suppress_process_exceptions
| bool fiftyone_pipeline_core.pipelinebuilder.PipelineBuilder.suppress_process_exceptions = settings["suppress_process_exceptions"] |
◆ use_setheader_properties
| bool fiftyone_pipeline_core.pipelinebuilder.PipelineBuilder.use_setheader_properties = settings["use_setheader_properties"] |
