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: 1.4.0.476 (1.4.0.476)
Syntax
public sealed class EmbeddedJobScheduler : IJobScheduler, 
        IDisposable, IGetHostLog, IGetVersionInfo, IMessageEndpoint

The EmbeddedJobScheduler type exposes the following members.

Constructors
  Name Description
Public method EmbeddedJobScheduler
Initializes a new instance of the EmbeddedJobScheduler class passing in the number of cores as the number of hosts to start.
Public method EmbeddedJobScheduler(Int32)
Initializes a new instance of the EmbeddedJobScheduler class passing in 32 as the number of tasks per host.
Public method EmbeddedJobScheduler(Int32, Int32)
Initializes a new instance of the EmbeddedJobScheduler class.
Top
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 embedded 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 embedded 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 method GetHashCode
Serves as the default hash function.
(Inherited from Object.)
Public method GetHostLog
Gets the host log.
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 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 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 that the job scheduler can add the job to it's queue.
Public method ToString
Returns a string that represents the current object.
(Inherited from Object.)
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
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 Scalability 1.4 API for .NET