Provides the methods used to submit and monitor jobs to a job scheduler.
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 interface IJobScheduler : IDisposable
Visual Basic
Public Interface IJobScheduler _
        Inherits IDisposable

Remarks

After creating an instance of this class, call the Connect()()()() method to connect to the cluster. You can then submit and monitor jobs.

Examples

  Copy imageCopy
using System;
using AGI.Parallel.Client;
using AGI.Parallel.Infrastructure;

namespace CodeSamples
{
    class Program
    {
        static void Main(string[] args)
        {
            // Create the ClusterJobScheduler class.
            // Specify the hostname and optionally the port number in the ClusterJobScheduler constructor.
            // You must ensure you call the Dispose method. In this method we are utilizing the using statement.
            using (IJobScheduler scheduler = new ClusterJobScheduler("localhost"))
            {
                // Before you use any methods on the object, you must call Connect.
                try
                {
                    scheduler.Connect();

                    // Create a job, add a task, and submit.
                    Job job = scheduler.CreateJob();
                    job.AddTask(new HelloTask());

                    job.Submit();
                    job.WaitUntilDone();
                    Console.WriteLine("Result: " + job.Tasks[0].Result);
                }
                catch (JobSchedulerException e)
                {
                    Console.WriteLine("JobSchedulerException: " + e);
                }
            }
        }

        [Serializable]
        public class HelloTask : Task
        {
            public override void Execute()
            {
                Result = "Hello from Task";
            }
        }
    }
}

See Also