ClusterJobScheduler Class

Provides the methods used to submit and monitor jobs to cluster scheduler.
Inheritance Hierarchy
SystemObject
  AGI.Parallel.ClientClusterJobScheduler
Namespace:  AGI.Parallel.Client
Assembly:  AGI.Parallel.Client (in AGI.Parallel.Client.dll) Version: 1.3.0.366 (1.3.0.366)
Syntax
public sealed class ClusterJobScheduler : IJobScheduler, 
        IDisposable, ICheckCapability, IEnforceTaskPrecondition, IGetLicenseInfo, IGetAgentInfo, 
        IGetAuthorizationInfo, IGetVersionInfo, IMessageEndpoint

The ClusterJobScheduler type exposes the following members.

Constructors
  Name Description
Public method ClusterJobScheduler
Initializes a new instance of the ClusterJobScheduler class.
Public method ClusterJobScheduler(String)
Initializes a new instance of the ClusterJobScheduler class with the specified coordinator host name.
Public method ClusterJobScheduler(String, Int32, Boolean, Boolean)
Initializes a new instance of the ClusterJobScheduler class with the specified coordinator host name and coordinator port.
Top
Properties
  Name Description
Public property AllowSelfSignedCertificates
Gets or sets a value indicating whether to allow self-signed certificates when communicating with the coordinator.
Public property CoordinatorMachineName
Gets or sets the name of the coordinator.
Public property CoordinatorPort
Gets or sets port number of the coordinator.
Public property CoordinatorReconnectionDelay
Gets or sets the amount of time, in milliseconds, the scheduler should wait before attempting to reconnect to the coordinator.
Public property CoordinatorReconnectionInterval
Gets or sets the amount of time, in milliseconds, the scheduler should wait in between each reconnection attempt.
Public property Id
Gets the id of this job scheduler.
Public property IsConnected
Gets a value indicating whether the job scheduler is connected.
Public property MaximumReconnectionAttempts
Gets or sets the maximum number of times the job scheduler should try to reconnect to the coordinator before aborting.
Public property SslClientAuthenticationTimeOut
Gets or sets the SSL authentication timeout specified in miliseconds.
Public property UseSsl
Gets or sets a value indicating whether to use SSL when communicating with the coordinator.
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 CheckCapability(ICapabilityCheck)
Checks capability on all the agents.
Public method CheckCapability(ICapabilityCheck, IListTaskPrecondition)
Checks capability on agents which meets the specified precondition.
Public methodCode example Connect
Connects client to specified cluster 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.
Public method Equals
Determines whether the specified object is equal to the current object.
(Inherited from Object.)
Protected method Finalize
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object.)
Public methodCode example GetAgentInfo
Returns the list of agents and their current states.
Public method GetHashCode
Serves as the default hash function.
(Inherited from Object.)
Public method GetLicenseInfo
Gets the license info that matches the provided license parameters.
Public methodCode example GetMaximumHostCount
Returns the maximum number of hosts that is available to the job scheduler.
Public method GetType
Gets the Type of the current instance.
(Inherited from Object.)
Public methodCode example GetUserAuthorization
Determines whether the user is authorized for the job submission protocol.
Public method GetVersionInfo
Gets the version info of the job scheduler.
Protected method MemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Public method OnCoordinatorDisconnected
Called when the job scheduler connection with the coordinator is interrupted. Attempts to reestablish a connection with the coordinator until either a connection is obtained or the maximum number of attempts to reconnect has been reached.
Public method PostMessage(Object, Guid)
Posts a message to the specified target mailbox.
Public method PostMessage(Object, Guid, Boolean)
Posts a message to the specified target mailbox.
Public method ReceiveMessage
Receives a message from the participant's mailbox. Blocks the current thread until a message arrives.
Public method ReceiveMessage(Guid)
Receives a message from the participant's mailbox. Blocks the current thread until a message arrives.
Public method ReceiveMessage(Int32)
Receives a message from the participant's mailbox. Blocks the current thread until a message arrives.
Public method ReceiveMessage(Int32, Guid)
Receives a message from the participant's mailbox. Blocks the current thread until a message arrives.
Public method SubmitJob
Submits job to the job scheduler so the job scheduler can add the job to its queue.
Public method ToString
Returns a string that represents the current object.
(Overrides ObjectToString.)
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
Events
  Name Description
Public event NewMessage
Occurs when a new message arrives.
Top
Remarks
After creating an instance of this class, call the Connect method to connect to the cluster scheduler. You can then submit and monitor jobs. We recommend that instead of using this class you instead use the IJobScheduler interface if possible.
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