JobTaskExecutionTimeout Property |
Namespace: AGI.Parallel.Client
using System; using System.Threading; using AGI.Parallel.Client; using AGI.Parallel.Infrastructure; namespace CodeSamples { class Program { static void Main(string[] args) { using (IJobScheduler scheduler = new ClusterJobScheduler("localhost")) { scheduler.Connect(); Job job = scheduler.CreateJob(); // For example, specify to let the tasks run for 20 seconds. job.TaskExecutionTimeout = 20000; Task task = new LongRunningTask(); job.AddTask(task); job.Submit(); job.WaitUntilDone(); Console.WriteLine("TaskStatus = {0}", task.TaskStatus); } /* * The output of the application should resemble: * TaskStatus = TimedOut. */ } [Serializable] class LongRunningTask : Task { public override void Execute() { // For example, sleep forever. If TaskExecutionTimeout was not specified, this task would run forever. Thread.Sleep(Timeout.Infinite); } } } }
STK Parallel Computing Server 2.9 API for .NET