Gets or sets the timeout for task execution in milliseconds.
Namespace: AGI.Parallel.Infrastructure
Assembly: AGI.Parallel.Infrastructure (in AGI.Parallel.Infrastructure.dll) Version: 1.2.0.275 (1.2.0.275)

Syntax

C#
int TaskExecutionTimeout { get; set; }
Visual Basic
Property TaskExecutionTimeout As Integer
        Get
        Set

Field Value

The timeout in milliseconds.

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

  Copy imageCopy
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