Click or drag to resize

JobTaskExecutionTimeout Property

Gets or sets the timeout for task execution in milliseconds.

Namespace:  AGI.Parallel.Client
Assembly:  AGI.Parallel.Client (in AGI.Parallel.Client.dll) Version: 2.9.0.1601 (2.9.0.1601)
Syntax
public int TaskExecutionTimeout { get; set; }

Property Value

Type: Int32
The timeout in milliseconds.

Implements

IJobTaskExecutionTimeout
Remarks
TaskExecutionTimeout is the number of milliseconds that a task can run before it is considered timed out. The TaskExecutionTimeout applies to the task execution, it does not include TaskEnvironment setup time or the time duration that passes after a task has been submitted.
Examples
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);
            }
        }
    }
}
See Also

STK Parallel Computing Server 2.9 API for .NET