deephyper.evaluator.storage.RedisStorage#
- class deephyper.evaluator.storage.RedisStorage(host='localhost', port=6379, db=0)[source]#
Bases:
Storage
Storage client for Redis.
The Redis server should be started with the Redis-JSON module loaded.
- Parameters:
Methods
Connect the storage client to the storage service.
Static method allowing the creation of a storage client.
Creates a new job in the store and returns its identifier.
Create a new search in the store and returns its identifier.
Loads the identifiers of all recorded jobs in the search.
Loads the identifiers of all recorded searches.
Loads the data of a job.
Load all data from a given list of jobs' identifiers.
Loads a given metadata value from all jobs.
Loads the output value from all jobs.
Loads the data of a search.
Loads the value corresponding to key for search_id.
Stores the value corresponding to key for job_id.
Stores the input arguments of the executed job.
Stores other metadata related to the execution of the job.
Stores the output value of the executed job.
Stores the value corresponding to key for search_id.
- connect() StorageType #
Connect the storage client to the storage service.
- static create(method: str = 'memory', method_kwargs: Dict = None) StorageType #
Static method allowing the creation of a storage client.
- Parameters:
method (str, optional) – the type of storage client in
["memory", "redis"]
. Defaults to “memory”.method_kwargs (Dict, optional) – the client keyword-arguments parameters. Defaults to None.
- Raises:
ValueError – if the type of requested storage client is not valid.
- Returns:
the created storage client.
- Return type:
- create_new_job(search_id: Hashable) Hashable [source]#
Creates a new job in the store and returns its identifier.
- Parameters:
search_id (Hashable) – The identifier of the search in which a new job
created. (is)
- Returns:
The created identifier of the job.
- Return type:
Hashable
- create_new_search() Hashable [source]#
Create a new search in the store and returns its identifier.
- Returns:
The identifier of the search.
- Return type:
Hashable
- load_all_job_ids(search_id: Hashable) List[Hashable] [source]#
Loads the identifiers of all recorded jobs in the search.
- Parameters:
search_id (Hashable) – The identifier of the search.
- Returns:
A list of identifiers of all the jobs.
- Return type:
List[Hashable]
- load_all_search_ids() List[Hashable] [source]#
Loads the identifiers of all recorded searches.
- Returns:
A list of identifiers of all the recorded searches.
- Return type:
List[Hashable]
- load_job(job_id: Hashable) dict [source]#
Loads the data of a job.
- Parameters:
job_id (Hashable) – The identifier of the job.
- Returns:
The corresponding data of the job.
- Return type:
- load_jobs(job_ids: List[Hashable]) dict [source]#
Load all data from a given list of jobs’ identifiers.
- load_metadata_from_all_jobs(search_id: Hashable, key: Hashable) List[Any] [source]#
Loads a given metadata value from all jobs.
- Parameters:
search_id (Hashable) – The identifier of the search.
key (Hashable) – The identifier of the value.
- Returns:
A list of all the retrieved metadata values.
- Return type:
List[Any]
- load_out_from_all_jobs(search_id: Hashable) List[Any] [source]#
Loads the output value from all jobs.
- Parameters:
search_id (Hashable) – The identifier of the search.
- Returns:
A list of all the retrieved output values.
- Return type:
List[Any]
- load_search(search_id: Hashable) dict [source]#
Loads the data of a search.
- Parameters:
search_id (Hashable) – The identifier of the search.
- Returns:
The corresponding data of the search.
- Return type:
- load_search_value(search_id: Hashable, key: Hashable) Any [source]#
Loads the value corresponding to key for search_id.
- Parameters:
search_id (Hashable) – The identifier of the job.
key (Hashable) – A key to use to access the value.
- store_job(job_id: Hashable, key: Hashable, value: Any) None [source]#
Stores the value corresponding to key for job_id.
- Parameters:
job_id (Hashable) – The identifier of the job.
key (Hashable) – A key to use to store the value.
value (Any) – The value to store. A “nan” float value is stored as a str “NaN”.
- store_job_in(job_id: Hashable, args: Tuple = None, kwargs: Dict = None) None [source]#
Stores the input arguments of the executed job.
- Parameters:
job_id (Hashable) – The identifier of the job.
args (Optional[Tuple], optional) – The positional arguments. Defaults to None.
kwargs (Optional[Dict], optional) – The keyword arguments. Defaults to None.
- store_job_metadata(job_id: Hashable, key: Hashable, value: Any) None [source]#
Stores other metadata related to the execution of the job.
- Parameters:
job_id (Hashable) – The identifier of the job.
key (Hashable) – A key to use to store the metadata of the given job.
value (Any) – The value to store.