:py:mod:`execution_repository` ============================== .. py:module:: execution_repository .. autoapi-nested-parse:: Service to interact with execution data stored in Redis cache. Module Contents --------------- Classes ~~~~~~~ .. autoapisummary:: execution_repository.ExecutionRepository .. py:class:: ExecutionRepository(redis_cache, mongo_client, execution_collection = __EXECUTION_COLLECTION) A repository class to manage execution data in Redis cache. .. py:attribute:: EXECUTION_DATA_TEMPLATE :value: 'execution_data:{user_name}:{execution_id}' .. py:attribute:: EXECUTION_ID_TO_USER_INDEX_TEMPLATE :value: 'execution_id_to_user_mapping:{execution_id}' .. py:attribute:: USER_TO_EXECUTION_IDS_TEMPLATE :value: 'user_to_execution_ids_set:{user_name}' .. py:attribute:: __EXECUTION_COLLECTION .. py:attribute:: logger .. py:method:: create_execution_id_to_user_mapping(execution_id, user_name) :async: Save execution ID to username mapping in inverted index. .. py:method:: get_execution_model(user_name, execution_id) :async: Fetch the full execution details dictionary. .. py:method:: get_latest_execution_ids(user_name, start = 0, end = -1) :async: Get the N latest execution IDs for a user. .. py:method:: get_latest_execution_models(user_name, start = 0, end = -1) :async: Get the N latest executions for a user. Note: Without a Hash, this performs MGET on full detail strings. .. py:method:: get_user_name_from_execution_id(execution_id) :async: Fetch the username associated with a execution ID from the inverted index. .. py:method:: initialize_execution_data(execution_model) :async: Save execution model data to Redis cache and update the user's execution id set. 1. Save the full details as a String with Key: "john:101" 2. Update the Sorted Set index with Key: "users:john:index", Score: timestamp, Member: execution_id .. py:method:: save_execution_data(user_name, execution_id, execution_model) :async: Save only the execution data dictionary. .. py:method:: save_execution_id_to_user_set(user_name, execution_id, timestamp) :async: Update only the execution index sorted set.