Returns the list of agents and their current states.
Namespace: AGI.Parallel.Client
Assembly: AGI.Parallel.Client (in AGI.Parallel.Client.dll) Version: 1.2.0.275 (1.2.0.275)

Syntax

C#
public IList<AgentSnapshot> GetAgentInfo()
Visual Basic
Public Function GetAgentInfo As IList(Of AgentSnapshot)

Return Value

List of agent snapshots.

Implements

IGetAgentInfo..::..GetAgentInfo()()()()

Examples

  Copy imageCopy
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
             */
        }
    }
}

Exceptions

Exception Condition
AGI.Parallel.Client..::..JobSchedulerException Thrown if there is an error getting the list of agents.

See Also