JobCancel Method |
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 (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); } } } } }
STK Parallel Computing Server 2.9 API for .NET