Click or drag to resize

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: 2.7.0.1440 (2.7.0.1440)
Syntax
public sealed class ClusterJobScheduler : IJobScheduler, 
	IDisposable, ICheckCapability, IEnforceTaskPrecondition, IGetLicenseInfo, IGetAgentInfo, 
	IGetAuthorizationInfo, IGetVersionInfo, IMessageEndpoint

The ClusterJobScheduler type exposes the following members.

Constructors
  NameDescription
Public methodClusterJobScheduler
Initializes a new instance of the ClusterJobScheduler class.
Public methodClusterJobScheduler(String)
Initializes a new instance of the ClusterJobScheduler class with the specified Coordinator host name.
Public methodClusterJobScheduler(String, Int32, Boolean, Boolean, Boolean, String, Boolean, String, String)
Initializes a new instance of the ClusterJobScheduler class with the specified Coordinator host name, port, and security options.
Top
Properties
  NameDescription
Public propertyAllowSelfSignedCertificates
Gets or sets a value indicating whether to allow self-signed certificates when communicating with the Coordinator.
Public propertyClientCertificateFile
Gets or sets the certificate file.
Public propertyClientCertificateName
Gets or sets the subject distinguished name of the certificate in the local Windows certificate store to authenticate.
Public propertyClientCertificateThumbprint
Gets or sets the certificate using the SHA1 thumbprint.
Public propertyConnectReadTimeOut
Gets or sets the connect read time out in milliseconds.
Public propertyCoordinatorMachineName
Gets or sets the name of the coordinator.
Public propertyCoordinatorPort
Gets or sets port number of the Coordinator.
Public propertyCoordinatorReconnectionDelay
Gets or sets the amount of time, in milliseconds, the scheduler should wait before attempting to reconnect to the Coordinator.
Public propertyCoordinatorReconnectionInterval
Gets or sets the amount of time, in milliseconds, the scheduler should wait in between each reconnection attempt.
Public propertyCoordinatorThumbprint
Gets or sets the Coordinator thumbprint. The client checks this thumbprint matches that of the Coordinator's security certificate to ensure it can trust the Coordinator.
Public propertyId
Gets the id of this job scheduler.
Public propertyIsConnected
Gets a value indicating whether the job scheduler is connected.
Public propertyMaximumReconnectionAttempts
Gets or sets the maximum number of times the job scheduler should try to reconnect to the Coordinator before aborting.
Public propertyProvideClientCertificate
Gets or sets a value indicating whether to send a client certificate when authenticating.
Public propertySslClientAuthenticationTimeOut
Gets or sets the SSL authentication timeout specified in milliseconds.
Public propertyUseSsl
Gets or sets a value indicating whether to use SSL when communicating with the Coordinator.
Public propertyVerifyCoordinatorThumbprint
Gets or sets a value indicating whether to verify the coordinator thumbprint.
Top
Methods
  NameDescription
Public methodCancelJob
Cancels the job with the specified id.
Public methodCancelTask
Cancels the task with the specified id.
Public methodCheckCapability(ICapabilityCheck)
Checks capability on all the agents.
Public methodCheckCapability(ICapabilityCheck, IListTaskPrecondition)
Checks capability on agents which meets the specified precondition.
Public methodCode exampleConnect
Connects client to specified cluster scheduler.
Public methodCreateJob
Returns a new job that can later be used to submit to the job scheduler.
Public methodDisconnect
Disconnects client from specified job scheduler.
Public methodDispose
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
Public methodEquals
Determines whether the specified object is equal to the current object.
(Inherited from Object.)
Protected methodFinalize
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 exampleGetAgentInfo
Returns the list of agents and their current states.
Public methodGetHashCode
Serves as the default hash function.
(Inherited from Object.)
Public methodGetLicenseInfo
Gets the license info that matches the provided license parameters.
Public methodCode exampleGetMaximumHostCount
Returns the maximum number of hosts that is available to the job scheduler.
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Public methodCode exampleGetUserAuthorization
Determines whether the user is authorized for the job submission protocol.
Public methodGetVersionInfo
Gets the version info of the job scheduler.
Protected methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Public methodOnCoordinatorDisconnected
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 methodPostMessage(Object, Guid)
Posts a message to the specified target mailbox.
Public methodPostMessage(Object, Guid, Boolean)
Posts a message to the specified target mailbox.
Public methodReceiveMessage
Receives a message from the participant's mailbox. Blocks the current thread until a message arrives.
Public methodReceiveMessage(Guid)
Receives a message from the participant's mailbox. Blocks the current thread until a message arrives.
Public methodReceiveMessage(Int32)
Receives a message from the participant's mailbox. Blocks the current thread until a message arrives.
Public methodReceiveMessage(Int32, Guid)
Receives a message from the participant's mailbox. Blocks the current thread until a message arrives.
Public methodSubmitJob
Submits job to the job scheduler so the job scheduler can add the job to its queue.
Public methodToString
Returns a string that represents the current object.
(Overrides ObjectToString.)
Public methodWaitUntilDone
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
  NameDescription
Public eventNewMessage
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 Parallel Computing Server 2.7 API for .NET