Click or drag to resize

EmbeddedJobScheduler Class

Provides the methods used to submit and monitor jobs to embedded scheduler.
Inheritance Hierarchy
SystemObject
  AGI.Parallel.ClientEmbeddedJobScheduler

Namespace:  AGI.Parallel.Client
Assembly:  AGI.Parallel.EmbeddedClient (in AGI.Parallel.EmbeddedClient.dll) Version: 2.7.0.1440 (2.7.0.1440)
Syntax
public sealed class EmbeddedJobScheduler : IJobScheduler, 
	IDisposable, IGetHostLog, IGetVersionInfo, IMessageEndpoint

The EmbeddedJobScheduler type exposes the following members.

Constructors
  NameDescription
Public methodEmbeddedJobScheduler
Initializes a new instance of the EmbeddedJobScheduler class passing in the number of cores as the number of hosts to start.
Public methodEmbeddedJobScheduler(Int32)
Initializes a new instance of the EmbeddedJobScheduler class passing in the number of cores as the number of hosts to start and the default machine memory budget.
Public methodEmbeddedJobScheduler(Int32, Int32)
Initializes a new instance of the EmbeddedJobScheduler class passing in 32 as the number of tasks per host.
Public methodEmbeddedJobScheduler(Int32, Int32, Int32)
Initializes a new instance of the EmbeddedJobScheduler class.
Top
Properties
  NameDescription
Public propertyId
Gets or sets the identifier associated with this scheduler.
Public propertyIsConnected
Gets a value indicating whether the job scheduler is connected.
Top
Methods
  NameDescription
Public methodCancelJob
Cancels the job with the specified id.
Public methodCancelTask
Cancels the task with the specified id.
Public methodConnect
Connects client to embedded scheduler.
Public methodCreateJob
Returns a new job that can later be used to submit to the job scheduler.
Public methodDisconnect
Disconnects client from embedded 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 methodGetHashCode
Serves as the default hash function.
(Inherited from Object.)
Public methodGetHostLog
Gets the host log.
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 methodGetVersionInfo
Gets the version info of the job scheduler.
Protected methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
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 that the job scheduler can add the job to it's queue.
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
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
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 EmbeddedJobScheduler class.
            // You can optionally specify the number of cores you want to use.
            // By default, it will use the number of cores available on your machine.
            using (IJobScheduler scheduler = new EmbeddedJobScheduler(4))
            {
                // 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