IJobScheduler Interface

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.3.0.366 (1.3.0.366)
Syntax
public interface IJobScheduler : IDisposable

The IJobScheduler type exposes the following members.

Properties
  Name Description
Public property Id
Gets the id of this job scheduler.
Public property IsConnected
Gets a value indicating whether the job scheduler is connected.
Top
Methods
  Name Description
Public method CancelJob
Cancels the job with the specified id.
Public method CancelTask
Cancels the task with the specified id.
Public method Connect
Connects client to specified job scheduler.
Public method CreateJob
Returns a new job that can later be used to submit to the job scheduler.
Public method Disconnect
Disconnects client from specified job scheduler.
Public method Dispose
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
(Inherited from IDisposable.)
Public methodCode example GetMaximumHostCount
Returns the maximum number of hosts that is available to the job scheduler.
Public method SubmitJob
Submits job to the job scheduler so the job scheduler can add the job to its queue.
Public method WaitUntilDone
Blocks until all tasks in this job complete or the operation times out. The callback passed in for the heartbeat is called with the period specified by the millisecondsHeartbeat argument.
Top
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
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

STK Scalability 1.3 API for .NET