Răspuns How to Create Dependent Task in HPC

  • 25/رجب/1429 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

جميع الردود

  • 25/رجب/1429 09:00 م
    المشرف
     
     الإجابة يتضمن تعليمات برمجية

    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
    • تم الاقتراح كإجابة بواسطة Josh BarnardModerator 25/رجب/1429 09:00 م
    • تم وضع علامة كإجابة بواسطة PVASNMurthy 26/رجب/1429 04:38 ص
    •