phenome_core.core.base.base_results module

class BaseResults(model_classtype)

Bases: object

The base class for polled and queried results during processing of objects. A results Object is CLASSTYPE specific. Each CLASSTYPE will have it’s own results object stored in memory during the application lifetime.

This should be subclassed per application to provide application specific object handling.

clear_results()

Clears all the results :return: None

copy_result_data(results, update_global_data=True)

Copies all result data to another results object. :param results: (BaseResults): The new results object data will be copied to :param update_global_data: if True, update global Results Object as well. :return: Results Object - the finished (copied) result set

get_last_error_message_by_object(obj_id)

Gets the last error message for a particular object :param obj_id: :return:

get_new_object_state()

Creates a new Object State helper object :return: ObjectState object

get_object_info(obj_id)
get_object_states()

Returns the states of all objects in this Result Set :return: dict of ObjectStates

get_result(obj_id, result_id)

Retrieves a result for a particular object and result KPI :param obj_id: The object ID for which the result is desired :param result_id: The KPI ID for which the result is desired :return: Object if there is a result, None if no result

get_results(result_id)

Retrieves all results for a particular KPI :param result_id: The KPI to return :return: dict of results

get_results_collection()

Returns the Results Collection object, which is a dict of dicts :return: dict of dicts

has_object(obj_id)
has_results(obj_id)
is_notify_enabled()
is_retrieve_enabled()
populate(obj)

Populates the Result Object with a new Object. Handles all lookups, etc. :param object: The object to populate :return: None

populate_model(objects, models)

Populates the Result Object with Objects and Models :param objects: The Objects to populate :param models: The Object Models to populate :return: None

reset_by_object_id(obj_id, delete)

Resets or deletes all data for a particular object :param obj_id: The object ID for the object :param delete: Boolean if set to True, will delete all data :return: None

retrieve_model()

Populates the Object and Model collections for the particular CLASSTYPE :return: None

set_notify_enabled(enabled)
set_object(obj)

Initializes the object list and add the object. Should only be used first time initialization of Results or in Unit Testing :param obj: The object :return: None

set_result(obj, result_id, result_value)

Sets a single result for an object :param obj: The object to which the result belong :param result_id: The “ID” of the KPI :param result_value: The value of the KPI :return: None

set_results_collection(results)
set_retrieve_enabled(enabled)
set_timewindow(timewindow_ms)

Sets the timewindow :param timewindow_ms: :return: None

update_datamodel()

Updates the data model with collected stats. Usually should be called after a poll cycle :return: None

update_health_score(obj)

Updates a health score for a specific object :param obj: :return:

update_health_scores()

Updates all health scores of objects :return: None

class ObjectState

Bases: object

The base class for object state.