none
How to define tasks groups using command-line/powershell interface RRS feed

  • Question

  • Hi everybody,

    When i use HPC from the GUI i can create tasks in defined groups while each group depends on the previous one :

    for example group1 with task1,task2,task3 and group2 with task 4,task5. It enables to define dependencies between tasks groups in elegant way.

     

    However when i use the CLI or the powershell i didn't find this option:

    1. Using CLI the only possible command is "job add <jobId> [/depend:<task_name>]..." where <task_name> can be only one task.

    2. Using powershell the situation is little bit better. The relevant command is "dd-HpcTask [-CommandLine <string>] [-Depend <string[]>]" where            -depend can be be followed by list of tasks. But still not elegant like the GUI option.

     

    Is there a way to use the same option of tasks groups also in the CLI/powershell interfaces ?

    thank you.

    Tuesday, November 2, 2010 7:03 PM

Answers

  • Hi,

    Unfortunately there is no elegant way of setting task dependencies with task groups using command-line or powershell. Actual task groups are only available in GUI.

    However there is a workaround, which involves giving all tasks from expected group the same name.

    Example for command-line:

    job new
    
    job add <JOB_ID> /name:A ping -n 5 localhost
    job add <JOB_ID> /name:A ping -n 5 localhost
    job add <JOB_ID> /name:A ping -n 5 localhost
    
    job add <JOB_ID> /name:B /depend:A ping -n 5 localhost
    job add <JOB_ID> /name:B /depend:A ping -n 5 localhost
    
    job add <JOB_ID> /name:C /depend:B ping -n 5 localhost
    job add <JOB_ID> /name:C /depend:B ping -n 5 localhost
    
    job submit /id:<JOB_ID> 

    <JOB_ID> - id of newly created job, returned by job new
    'ping -n 5 localhost' - sample command, which will execute for about 5 seconds

    When job from example will start running, it will first execute tasks with name A, when they are finished tasks with name B will be allowed to start and tasks with name C will be the last group to execute.

    Let me know if this is helpful.

    Thanks,
    Łukasz

    Friday, November 5, 2010 2:30 PM

All replies

  • Hi,

    Unfortunately there is no elegant way of setting task dependencies with task groups using command-line or powershell. Actual task groups are only available in GUI.

    However there is a workaround, which involves giving all tasks from expected group the same name.

    Example for command-line:

    job new
    
    job add <JOB_ID> /name:A ping -n 5 localhost
    job add <JOB_ID> /name:A ping -n 5 localhost
    job add <JOB_ID> /name:A ping -n 5 localhost
    
    job add <JOB_ID> /name:B /depend:A ping -n 5 localhost
    job add <JOB_ID> /name:B /depend:A ping -n 5 localhost
    
    job add <JOB_ID> /name:C /depend:B ping -n 5 localhost
    job add <JOB_ID> /name:C /depend:B ping -n 5 localhost
    
    job submit /id:<JOB_ID> 

    <JOB_ID> - id of newly created job, returned by job new
    'ping -n 5 localhost' - sample command, which will execute for about 5 seconds

    When job from example will start running, it will first execute tasks with name A, when they are finished tasks with name B will be allowed to start and tasks with name C will be the last group to execute.

    Let me know if this is helpful.

    Thanks,
    Łukasz

    Friday, November 5, 2010 2:30 PM
  • Thanks for the solution, but i prefer not to give the same names for different tasks. 

    It will only make life hard when some tasks will fail and i'll be looking for the reason.

    I guess i will use the powershell, without the groups definition.  

    It's very strange the command line and powershell interfaces are so poor related to the GUI.

     

    By the way,  in the command line interface a task can only depend on one task or more ?

    Is it possible to write job add <JOB_ID> /name:C /depend:A,B ping -n 5 localhost ? sorry for the question, but i can't check it in my computer right now.



    Friday, November 5, 2010 2:57 PM
  • Yes, '/depend:' parameter supports multiple, comma separated tasks.

    Friday, November 5, 2010 3:13 PM