Click or drag to resize

JobCancel Method

Cancels all tasks in this job. Will not listen for cancellation events.

Namespace:  AGI.Parallel.Client
Assembly:  AGI.Parallel.Client (in AGI.Parallel.Client.dll) Version: 2.9.0.1601 (2.9.0.1601)
Syntax
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 (int i = 0; i < 100; ++i)
                {
                    job.AddTask(new WaitTask());
                }

                job.Submit();

                // Wait 10 seconds so the tasks queue up.
                Thread.Sleep(10000);

                // Cancel all the tasks in this job.
                job.Cancel();                

                job.WaitUntilDone();
            }
        }

        [Serializable]
        class WaitTask : Task
        {
            public override void Execute()
            {
                for (int i = 0; i < 100; ++i)
                {
                    Thread.Sleep(100);
                }
            }
        }
    }
}
See Also

STK Parallel Computing Server 2.9 API for .NET