\r\n

51Degrees Pipeline Python  4.4

51Degrees Pipeline for Python

fiftyone_pipeline_cloudrequestengine.cloudrequestengine.CloudRequestEngine Class Reference

Inheritance diagram for fiftyone_pipeline_cloudrequestengine.cloudrequestengine.CloudRequestEngine:

[legend]

Collaboration diagram for fiftyone_pipeline_cloudrequestengine.cloudrequestengine.CloudRequestEngine:

[legend]

Public Member Functions

def  __init__ (self, settings={})
Constructor for CloudRequestEngine. More...
def  flow_element_properties (self)
def  evidence_keys (self)
def  get_evidence_keys (self)
Internal function for getting evidence keys used by cloud engines @rtype: dict. More...
def  get_evidence_key_filter (self)
Instance of EvidenceKeyFilter based on the evidence keys fetched from the cloud service by the private getEvidenceKeys() method. More...
def  get_engine_properties (self)
Internal method to get properties for cloud engines from the cloud service. More...
def  validate_response (self, requests.Response cloud_response, check_for_error_messages=True)
Validate the JSON response from the cloud service. More...
def  make_cloud_request (self, type, url, content=None)
@type url: string More...
def  process_internal (self, flowdata)
Processing function for the CloudRequestEngine Makes a request to the cloud service with the supplied resource key and evidence and returns a JSON object that is then parsed by cloud engines placed later in the pipeline. More...
def  get_content (self, flowData)
Generate the Content to send in the POST request. More...
def  add_query_data (self, query_data, all_evidence, evidence)
Add query data to the evidence. More...
def  get_selected_evidence (self, evidence, type)
Get evidence with specified prefix. More...
def  key_has_prefix (self, itemKey, prefix)
Check that the key of a KeyValuePair has the given prefix. More...

Public Member Functions inherited from fiftyone_pipeline_engines.engine.Engine

def  set_cache (self, cache)
Add a cache to an engine @type cashe: Cache. More...
def  set_restricted_properties (self, properties_list)
Add a subset of properties. More...
def  in_cache (self, flowdata)
A method to check if a flowdata's evidence is in the cache. More...
def  refresh (self, identifier)
def  process (self, flowdata)
Engine's core process function. More...
def  on_registration (self, pipeline)
Called when an engine is registered with a pipeline and if there is a data file, a data file update service is attached to the parent pipeline. More...
def  register_data_file (self, data_file)
Register a data_file of the DataFile class with the engine @type data_file: DataFile. More...

Public Member Functions inherited from fiftyone_pipeline_core.flowelement.FlowElement

def  __init__ (self)
List of Pipelines the FlowElement has been added to. More...
def  filter_evidence (self, flowdata)
Filter FlowData evidence using the FlowElement's EvidenceKeyFilter. More...
def  filter_evidence_key (self, key)
Filter FlowData.evidence using the flowElement's EvidenceKeyFilter with the property key of evidence of interest. More...
def  get_properties (self)

Public Attributes

 properties
 resource_key  baseURL  http_client  cloud_request_origin  exclude_from_messages

Public Attributes inherited from fiftyone_pipeline_engines.engine.Engine

 data_file  cache  restricted_properties

Public Attributes inherited from fiftyone_pipeline_core.flowelement.FlowElement

 pipelines  properties  datakey  exclude_from_messages

Constructor & Destructor Documentation

◆ __init__()

def fiftyone_pipeline_cloudrequestengine.cloudrequestengine.CloudRequestEngine.__init__ (   self,
  settings = {}  
)

Constructor for CloudRequestEngine.

@type settings: dict

Parameters
settings - Settings should contain a resource_key and optionally 1) a cloud_endpoint to overwrite the default baseurl 2) an cloud_request_origin to use when making requests

Reimplemented from fiftyone_pipeline_engines.engine.Engine.

Member Function Documentation

◆ add_query_data()

def fiftyone_pipeline_cloudrequestengine.cloudrequestengine.CloudRequestEngine.add_query_data (   self,
  query_data,
  all_evidence,
  evidence  
)

Add query data to the evidence.

Parameters
- query_data: The destination dictionary to add query data to.
all_evidence - All evidence in the flow data. This is used to report which evidence keys are conflicting.
evidence - Evidence to add to the query Data.

◆ evidence_keys()

def fiftyone_pipeline_cloudrequestengine.cloudrequestengine.CloudRequestEngine.evidence_keys (   self )

◆ flow_element_properties()

def fiftyone_pipeline_cloudrequestengine.cloudrequestengine.CloudRequestEngine.flow_element_properties (   self )

◆ get_content()

def fiftyone_pipeline_cloudrequestengine.cloudrequestengine.CloudRequestEngine.get_content (   self,
  flowData  
)

Generate the Content to send in the POST request.

The evidence keys e.g. 'query.' and 'header.' have an order of precedence. These are added to the evidence in reverse order, if there is conflict then the queryData value is overwritten.

'query.' evidence should take precedence over all other evidence. If there are evidence keys other than 'query.' that conflict then this is unexpected so a warning will be logged.

Parameters
- flowData: FlowData
Returns
: Evidence Dictionary

◆ get_engine_properties()

def fiftyone_pipeline_cloudrequestengine.cloudrequestengine.CloudRequestEngine.get_engine_properties (   self )

Internal method to get properties for cloud engines from the cloud service.

@rtype: dict

Returns
: Returns properties for all engines

◆ get_evidence_key_filter()

def fiftyone_pipeline_cloudrequestengine.cloudrequestengine.CloudRequestEngine.get_evidence_key_filter (   self )

Instance of EvidenceKeyFilter based on the evidence keys fetched from the cloud service by the private getEvidenceKeys() method.

@type: BasicListEvidenceKeyFilter

Returns
: Returns BasicListEvidenceKeyFilter

Reimplemented from fiftyone_pipeline_core.flowelement.FlowElement.

◆ get_evidence_keys()

def fiftyone_pipeline_cloudrequestengine.cloudrequestengine.CloudRequestEngine.get_evidence_keys (   self )

Internal function for getting evidence keys used by cloud engines @rtype: dict.

Returns
: Returns list of keys

◆ get_selected_evidence()

def fiftyone_pipeline_cloudrequestengine.cloudrequestengine.CloudRequestEngine.get_selected_evidence (   self,
  evidence,
  type  
)

Get evidence with specified prefix.

Parameters
evidence - All evidence in the flow data.
type - Required evidence key prefix

◆ key_has_prefix()

def fiftyone_pipeline_cloudrequestengine.cloudrequestengine.CloudRequestEngine.key_has_prefix (   self,
  itemKey,
  prefix  
)

Check that the key of a KeyValuePair has the given prefix.

Parameters
itemKey - Key to check
prefix - The prefix to check for.
Returns
: True if the key has the prefix.

◆ make_cloud_request()

def fiftyone_pipeline_cloudrequestengine.cloudrequestengine.CloudRequestEngine.make_cloud_request (   self,
  type,
  url,
  content = None  
)

@type url: string

Parameters
url - @rtype: dict
Returns
Returns dict with data and error properties error contains any errors from the request, data contains the response

◆ process_internal()

def fiftyone_pipeline_cloudrequestengine.cloudrequestengine.CloudRequestEngine.process_internal (   self,
  flowdata  
)

Processing function for the CloudRequestEngine Makes a request to the cloud service with the supplied resource key and evidence and returns a JSON object that is then parsed by cloud engines placed later in the pipeline.

@type FlowData: FlowData

Parameters
FlowData - Returns a JSON object that is then parsed by cloud engines

Reimplemented from fiftyone_pipeline_core.flowelement.FlowElement.

◆ validate_response()

def fiftyone_pipeline_cloudrequestengine.cloudrequestengine.CloudRequestEngine.validate_response (   self,
requests.Response   cloud_response,
  check_for_error_messages = True  
)

Validate the JSON response from the cloud service.

@type: Response

Parameters
- Response returned from the cloud service. @rtype: Exception
Returns
: Thrown if there are errors returned from the cloud service.

Member Data Documentation

◆ baseURL

fiftyone_pipeline_cloudrequestengine.cloudrequestengine.CloudRequestEngine.baseURL

◆ cloud_request_origin

fiftyone_pipeline_cloudrequestengine.cloudrequestengine.CloudRequestEngine.cloud_request_origin

◆ datakey

fiftyone_pipeline_cloudrequestengine.cloudrequestengine.CloudRequestEngine.datakey

◆ exclude_from_messages

fiftyone_pipeline_cloudrequestengine.cloudrequestengine.CloudRequestEngine.exclude_from_messages

◆ http_client

fiftyone_pipeline_cloudrequestengine.cloudrequestengine.CloudRequestEngine.http_client

◆ properties

fiftyone_pipeline_cloudrequestengine.cloudrequestengine.CloudRequestEngine.properties

◆ resource_key

fiftyone_pipeline_cloudrequestengine.cloudrequestengine.CloudRequestEngine.resource_key
On This Page