Get the state of the cluster |
You want to get the list of agents connected to the cluster.
Call the GetAgentInfo method on the ClusterJobScheduler to retrieve the list of agents currently connected to the coordinator.
![]() |
---|
This feature is not available on the embedded scheduler. |
using System; using System.Collections.Generic; using AGI.Parallel.Client; using AGI.Parallel.Infrastructure; namespace CodeSamples { class Program { static void Main(string[] args) { using (ClusterJobScheduler scheduler = new ClusterJobScheduler("localhost")) { scheduler.Connect(); IList<AgentSnapshot> agents = scheduler.GetAgentInfo(); for (int i = 0; i < agents.Count; i++) { Console.WriteLine( "Agent #{0}, MachineName={1}, HostCount={2}, Activity={3}", i + 1, agents[i].MachineName, agents[i].Capacity, agents[i].Activity); } } /* * The output of the application should resemble: * Agent #1, MachineName=AgentComputerName1, HostCount=12, Activity=Idle * Agent #2, MachineName=AgentComputerName2, HostCount=8, Activity=Idle * Agent #3, MachineName=AgentComputerName3, HostCount=8, Activity=Idle * Agent #4, MachineName=AgentComputerName4, HostCount=8, Activity=Idle */ } } }
Getting the list of agents is useful when checking to make sure the coordinator is in a certain state before submitting tasks. Another use for getting the list of agents is to display the information for monitoring purposes.
STK Parallel Computing Server 2.10 API for .NET