Click or drag to resize

Job Class

Represents a group of tasks in the system.
Inheritance Hierarchy
SystemObject
  AGI.Parallel.ClientJob

Namespace:  AGI.Parallel.Client
Assembly:  AGI.Parallel.Client (in AGI.Parallel.Client.dll) Version: 2.9.0.1601 (2.9.0.1601)
Syntax
public class Job : IJob

The Job type exposes the following members.

Constructors
  NameDescription
Public methodJob
Initializes a new instance of the Job class.
Top
Properties
  NameDescription
Public propertyCode exampleAdditionalDependencies
Gets the additional dependency that are sent with the Job.
Public propertyAgentSelectionPreference
Gets or sets the agent selection preference.
Public propertyCancelOnClientDisconnection
Gets or sets a value indicating whether to cancel the tasks of this Job when the client disconnects.
Public propertyCode exampleCancelOnTaskFailure
Gets or sets a value indicating whether to cancel other tasks on this Job if another Task fails.
Public propertyDescription
Gets or sets the Job description.
Public propertyExcludedDependencies
Gets the excluded assemblies that are not sent with the Job.
Public propertyCode exampleExclusiveExecution
Gets or sets a value indicating whether the tasks on this job should have exclusive access to the resource it is running on.
Public propertyCode exampleFailIfPreconditionsNotSatisfied
Gets or sets a value indicating whether to fail all tasks immediately of this Job if the precondition is not satisfied.
Public propertyId
Gets the job's id.
Public propertyIsCanceled
Gets a value indicating whether this job has been canceled.
Public propertyMaxTaskInterruptedRetryAttempts
Gets or sets the maximum number of times a task will be retried if it is interrupted.
Public propertyMinimizeClientMessaging
Gets or sets a value indicating whether to minimize sending some messages from the Coordinator. If set to true, some events may not fire.
Public propertyName
Gets or sets the Job name.
Public propertyPriority
Gets or sets the job priority.
Public propertyRaiseEventsUsingSynchronizationContext
Gets or sets a value indicating whether Job and Task events such as JobCompleted are raised using the SynchronizationContext of the thread that submits the job. If this property is , no events are raised until WaitUntilDone is called, at which point the events are raised in the thread that calls it. If this property is , events are raised by posting them to the SynchronizationContext of the thread that calls Submit, no matter if WaitUntilDone is called or not.
Public propertyTaskEnvironment
Gets or sets Job's TaskEnvironment
Public propertyCode exampleTaskExecutionTimeout
Gets or sets the timeout for task execution in milliseconds.
Public propertyCode exampleTaskPreconditions
Gets the list of task pre conditions.
Public propertyTasks
Gets the tasks that are contained in this Job.
Top
Methods
  NameDescription
Public methodAddTask
Adds a task to Job.
Public methodCode exampleCancel
Cancels all tasks in this job. Will not listen for cancellation events.
Public methodCode exampleCancel(Boolean)
Cancels all tasks in this job.
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 methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Protected methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Public methodSubmit
Submits job to job scheduler.
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
Public methodWaitUntilDone
Blocks until all tasks in this job complete.
Public methodWaitUntilDone(Int32)
Blocks until all tasks in this job complete or the operation times out.
Public methodWaitUntilDone(Int32, Action, Int32)
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 eventCode exampleJobCompleted
Occurs when all tasks of a Job is completed.
Public eventJobSubmitted
Occurs when Job is submitted.
Public eventCode exampleTaskCompleted
Occurs when Task is completed.
Public eventCode exampleTaskProgressUpdated
Occurs when Task progress changes.
Public eventCode exampleTaskStateChanged
Occurs when Task status changes.
Top
Examples
using (IJobScheduler scheduler = new ClusterJobScheduler("localhost"))
{
    scheduler.Connect();

    // Create job using IJobScheduler.CreateJob
    Job job = scheduler.CreateJob();

    // Add one or more tasks
    job.AddTask(new SimpleTask(1, 1));

    // Set the task environment
    job.TaskEnvironment = new MyEnvironment();

    // Set the various job options
    job.Name = "My job name";
    job.Description = "My job description";
    job.MaxTaskInterruptedRetryAttempts = 0;
    job.Priority = JobPriority.Low;
    job.TaskPreconditions.Add(CommonResources.AvailableCores, Operator.GreaterThan, 2);

    // Submit task to job scheduler
    job.Submit();

    // Wait for the results
    job.WaitUntilDone();
}
See Also

STK Parallel Computing Server 2.9 API for .NET