locked
How to Create Dependent Task in HPC RRS feed

  • Question

  • 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

    Monday, July 28, 2008 11:50 AM

Answers

  • 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
    Monday, July 28, 2008 9:00 PM
    Moderator