IJobScheduler Interface |
Namespace: AGI.Parallel.Client
The IJobScheduler type exposes the following members.
Name | Description | |
---|---|---|
Id |
Gets the id of this job scheduler.
| |
IsConnected |
Gets a value indicating whether the job scheduler is connected.
|
Name | Description | |
---|---|---|
CancelJob |
Cancels the job with the specified id.
| |
CancelTask |
Cancels the task with the specified id.
| |
Connect |
Connects client to specified job scheduler.
| |
CreateJob |
Returns a new job that can later be used to submit to the job scheduler.
| |
Disconnect |
Disconnects client from specified job scheduler.
| |
Dispose | Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. (Inherited from IDisposable.) | |
GetMaximumHostCount |
Returns the maximum number of hosts that is available to the job scheduler.
| |
SubmitJob |
Submits job to the job scheduler so the job scheduler can add the job to its queue.
| |
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.
|
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"; } } } }
STK Parallel Computing Server 2.9 API for .NET