none
How to Create Multi Dependent Task Groups in HPC RRS feed

  • Question

  • hi,

    my code basically  look like this:

    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);  
     

    i get an error if my string colection contain more than 75 tasks that i want to run parallely and have the final task depand on them all and run only if all the tasks finished successfully.

    the error i get is :

    "the value for "depends on" is too large for the database. the size should be smaller than 320"

    is there a way to configure it in some way or is it a known limitation?

    thanks in advanced,

    ben

    this

    Wednesday, July 13, 2011 7:36 AM

Answers

  • There is a similar thread in this forum, I just copy the answer here:

    Yes, you've hit a known limitation in task dependencies for the version V2 of HPC Server. i.e. The list of task names in the DependsOn value cannot be longer than 320 chars. This is fixed in the latest V3 Beta1. For V2, there are a couple of possible of workarounds:

    (i) The dependencies created via the GUI (HpcCLusterManager) do not have this limitation because it ues groups of tasks, rather than task names. Therefore, you can use the GUI to create the dependencies. If you need to re-use this set of tasks and dependencies, you could export the job to XML and then re-import it when you need it.

    -or-

    (ii) When you need to make a task dependent on a large set of tasks, then you can give each of the tasks in the large set the same task name. The value of DependsOn will then just be a single task name, and this will make the task dependent on all tasks with that name.


    Qiufang Shi
    • Marked as answer by Ben.Alterzon Thursday, July 21, 2011 10:53 AM
    Monday, July 18, 2011 6:28 AM

All replies

  • Can your 75 tasks that are being depended on be grouped as a parametric sweep task?
    Monday, July 18, 2011 5:36 AM
  • There is a similar thread in this forum, I just copy the answer here:

    Yes, you've hit a known limitation in task dependencies for the version V2 of HPC Server. i.e. The list of task names in the DependsOn value cannot be longer than 320 chars. This is fixed in the latest V3 Beta1. For V2, there are a couple of possible of workarounds:

    (i) The dependencies created via the GUI (HpcCLusterManager) do not have this limitation because it ues groups of tasks, rather than task names. Therefore, you can use the GUI to create the dependencies. If you need to re-use this set of tasks and dependencies, you could export the job to XML and then re-import it when you need it.

    -or-

    (ii) When you need to make a task dependent on a large set of tasks, then you can give each of the tasks in the large set the same task name. The value of DependsOn will then just be a single task name, and this will make the task dependent on all tasks with that name.


    Qiufang Shi
    • Marked as answer by Ben.Alterzon Thursday, July 21, 2011 10:53 AM
    Monday, July 18, 2011 6:28 AM
  • no, they can't,

    every task get a diffrent command line.

    thanks

    ben

    Thursday, July 21, 2011 10:53 AM
  • great thanks

    ben

    Thursday, July 21, 2011 10:53 AM
  • Is this still  (2012R2 Update 2) the recommended way to specify task dependency in the C# API, and is there a limit to the number of tasks in a group?

    Can a task group be specified (similar to dependency groups in the GUI)? E.g. via custom properties?

    Tuesday, August 25, 2015 12:34 PM
  • Hi Thomas,

      In 2012R2 Update 2, there is no limit on the number of tasks in a group. Currently there are three ways to specify task dependency:

    1. Through GUI, you can put tasks in task groups, Limitation: only sequential dependency within tasks

    2. Through API, through Task.DependsOn.Add(taskName), you can specify tree dependency for your tasks, and you can even add tasks with dependency on existing tasks while job is running

    3. Through Job XML. This is the fastest way to generate a job if there are lots of tasks with dependency relation within the job

    And, task Group can't be specified through API. Tasks with same tasks name with be in a same task group if other tasks set dependency on this name.

    Hope this works for you. And if you meet any problems or have suggestions, please let us know.


    Qiufang Shi

    • Proposed as answer by Thomas Kofoed Wednesday, August 26, 2015 6:34 AM
    Wednesday, August 26, 2015 1:58 AM
  • Excellent summary. Thanks again for your swift and complete replies.

    /Thomas

    Wednesday, August 26, 2015 6:35 AM