Accessing Swarm Results¶
After deploying and running the swarm, you can retrieve results and logs using the Cluster
object, allowing for effective monitoring and management of the swarms.
Results¶
When you use world.results.add(tag, data)
, you can retrieve these results using Cluster.select_results((swarm_id_1, [tag1, tag2, ...]), (swarm_id_2, [...]))
.
The output of select_results
is a Dict[swarm_id, Results]
, where Results
is an object which behaves as a three-dimensional array :
one dimension for iterations
one dimension of node IDs
one dimension of selected tags
Once the results are collected, in order to access a specific tag, you can call it to filter it :
>>> results_per_swarm_ids = cluster.select_results((swarm_id, ["metrics"]))
>>> results = results_per_swarm_ids[swarm_id]
>>> results.schema.rows
["node_a", "node_b", ...]
>>> results.schema.columns
["metrics"]
>>> metrics = results("metrics")
[[b"...", ..., b"..."], ..., [b"...", ..., b"..."]]
# ^^^^^^^^^^^^^^^^^^^ ^^^^^^
# iteration 0 node a
Node Activities¶
The method select_tasks(node_id)
allows you to know the activities of a specific node.
>>> for task_progression in cluster.select_tasks(node_id):
... print(task_progression)
{"task_id": ..., "swarm_id": ..., ..., "status": 3}
{"task_id": ..., "swarm_id": ..., ..., "status": 2}
{"task_id": ..., "swarm_id": ..., ..., "status": 3}
For detailed API calls and additional options, refer to the Cluster
API Documentation.
With this guide, you should be able to connect to a Manta cluster, deploy swarms, and monitor their execution effectively.