Shared results - Add and keep results in a shared database¶
- class manta_light.results.Results(host: str, port: int, task_id: str, chunk_size: int = 1048576)¶
Class for accessing results from the shared database or adding results into the shared database
- Parameters:
host (str) – Manager host
port (int) – Manager port
task_id (str) – Task ID
chunk_size (int) – Chunk size
- select(tag: str, size: int = -1, method: ResultMethod = ResultMethod.ALL)¶
Get the results of a Task
- Parameters:
tag (str) – The tag of the result to get
size (int, optional) – The number of results to get
method (ResultMethod, optional) – Method to use to select the results
- Returns:
The response from the world service
- Return type:
dict
Examples
Inside a
Task
class, you can select results stored in the Manager database from the attributeself.world
automatically created byTask
:>>> params = self.world.results.select("model_params")
- add(tag: str, result: dict)¶
Set a result of a task
- Parameters:
tag (str) – The tag of the result to set
result (dict) – The result to set
Examples
Inside a
Task
class, you can add results to be stored in the Manager database from the attributeself.world
automatically created byTask
:>>> self.world.results.add("metrics", metrics)
- async async_select(tag: str, size: int, method: ResultMethod) → dict¶
Get the results of tasks
- Parameters:
tag (str) – Tag of the result to get
size (int) – Number of results to get
method (str) – The method to use to select the results
- Returns:
Response from the world service
- Return type:
dict
Examples
Same as
select
but asynchronous:>>> params = await self.world.results.async_select("model_params")