Răspuns How to Create Dependent Task in HPC

  • 28. července 2008 11:50
     
     
    How to Create Dependent Tasks in HPC

    ISchedulerTask task1 = job.CreateTask();

    task.CommandLine = cmdparams1;

    job.AddTask(task1);

    ISchedulerTask task2 = job.CreateTask();

    task.CommandLine = cmdparams2;

    job.AddTask(task2);

    Here task2 is Depedends on task1. How to Create this Dependency?

    Thanks in Advance
    Murthy PVASn

Všechny reakce

  • 28. července 2008 21:00
    Moderátor
     
     Odpovědět Obsahuje kód

    You'll need to specify the list of tasks that task2 depends on (by name).  To extend your example:

    ISchedulerTask task1 = job.CreateTask();  
     
    task1.CommandLine = cmdparams1;  
     
    task1.Name = "First Task";  
     
    job.AddTask(task1);  
     
     
     
     
     
    ISchedulerTask task2 = job.CreateTask();  
     
    task2.CommandLine = cmdparams2;  
     
    IStringCollection earlierTasks = new StringCollection(); // Create a string collection with a list of earlier tasks  
     
    earlierTasks.Add("First Task"); // Add the name of the tasks to depend on  
     
    task2.DependsOn = earlierTasks; // Set the DependsOn field for task2  
     
     
    job.AddTask(task2);  
     

    -Josh