Process model queries (emmaa.answer_queries)

class emmaa.answer_queries.QueryManager(db=None, model_managers=None)[source]

Bases: object

Manager to run queries and interact with the database.

  • db (emmaa.db.EmmaaDatabaseManager) – An instance of a database manager to use.

  • model_managers (list[emmaa.model_tests.ModelManager]) – Optional list of ModelManagers to use for running queries. If not given, the methods will load ModelManager from S3 when needed.

answer_immediate_query(user_email, user_id, query, model_names, subscribe, bucket='emmaa')[source]

This method first tries to find saved result to the query in the database and if not found, runs ModelManager method to answer query.

answer_registered_queries(model_name, bucket='emmaa')[source]

Retrieve and asnwer registered queries

Retrieve queries registered on database for a given model, answer them, calculate delta between results and put results to a database.

  • model_name (str) – The name of the model

  • bucket (str) – The bucket to save the results to

get_registered_queries(user_email, query_type='path_property')[source]

Get formatted results to queries registered by user.

retrieve_results_from_hashes(query_hashes, query_type='path_property', latest_order=1)[source]

Retrieve results from a db given a list of query-model hashes.

emmaa.answer_queries.answer_queries_from_s3(model_name, db=None, bucket='emmaa')[source]

Answer registered queries with model manager on s3.

emmaa.answer_queries.format_results(results, query_type='path_property')[source]

Format db output to a standard json structure.