Accessing Swarm Results ======================= After deploying and running the swarm, you can retrieve results and logs using the :code:`Cluster` object, allowing for effective monitoring and management of the swarms. Results ------- When you use :code:`world.results.add(tag, data)`, you can retrieve these results using :code:`Cluster.select_results((swarm_id_1, [tag1, tag2, ...]), (swarm_id_2, [...]))`. The output of :code:`select_results` is a :code:`Dict[swarm_id, Results]`, where :class:`Results ` is an object which behaves as a three-dimensional array : .. image:: ../../_static/images/light-results.png :alt: Swarm :align: center :scale: 65% :class: only-light .. image:: ../../_static/images/dark-results.png :alt: Swarm :align: center :scale: 65% :class: only-dark - 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 : .. code:: python >>> 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 :code:`select_tasks(node_id)` allows you to know the activities of a specific node. .. code:: python >>> 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 :class:`Cluster ` API Documentation. With this guide, you should be able to connect to a Manta cluster, deploy swarms, and monitor their execution effectively.