locked
Tasks getting task and job information RRS feed

  • Question

  • When a task starts it can get any command line parameters submitted to it ..OK
    Typically in a parameter sweep you would provide the task index as, say arg[0]  C# code.

    You can also get environment variables

    Q1) Are there any special HPC/Job/Task environment variables available to the task?

    Q2) Are there any special HPC/Job/Task parameters that can be supplied to the command line?  eg *

    Q3 Are there any cluster etc classes that the task can instantiate  to get job/task/node/cluster  etc information

     

    Or is it just a matter of supplying such info programmatically on the specified commnd line for tasks  in task.CommandLine = ...

    Thanks.. Coming from a PBS background.


    DJaus Snr SW Dev (Embedded Systems and .NET)
    Wednesday, February 16, 2011 5:41 AM

Answers

  • Hi DJaus,

    Q1) There are some special environment variables available to the task during its execution. Their names are starting with 'CCP_', Examples:

    CCP_TASKID=1
    CCP_JOBID=7
    CCP_CLUSTER_NAME=LukaszTCluster
    CCP_MPI_NETMASK=157.59.132.0/255.255.252.0
    CCP_TASKINSTANCEID=0

    You can also set your own variables:

     - 'cluscfg setenvs' will set variables available to all jobs and tasks running on the cluster,
     - 'jobenv' job parameter will set variables available to all tasks in current job,
     - 'env' task parameter will set variables available to the current task.

    Q2) '*' character is special for parametric tasks and it will be replaced with numeric value assigned to particular subtask. Example:

    Job submitted with: 'job submit /parametric:5-10:2 echo ***' will have 3 subtasks with following commandlines:

    echo 005
    echo 007
    echo 009

    Q3) Yes, please see the examples: http://msdn.microsoft.com/en-us/library/cc907080(v=VS.85).aspx

    Best regards,
    Łukasz

    • Marked as answer by David Jones MVP Wednesday, February 16, 2011 10:19 PM
    Wednesday, February 16, 2011 5:14 PM

All replies

  • Hi DJaus,

    Q1) There are some special environment variables available to the task during its execution. Their names are starting with 'CCP_', Examples:

    CCP_TASKID=1
    CCP_JOBID=7
    CCP_CLUSTER_NAME=LukaszTCluster
    CCP_MPI_NETMASK=157.59.132.0/255.255.252.0
    CCP_TASKINSTANCEID=0

    You can also set your own variables:

     - 'cluscfg setenvs' will set variables available to all jobs and tasks running on the cluster,
     - 'jobenv' job parameter will set variables available to all tasks in current job,
     - 'env' task parameter will set variables available to the current task.

    Q2) '*' character is special for parametric tasks and it will be replaced with numeric value assigned to particular subtask. Example:

    Job submitted with: 'job submit /parametric:5-10:2 echo ***' will have 3 subtasks with following commandlines:

    echo 005
    echo 007
    echo 009

    Q3) Yes, please see the examples: http://msdn.microsoft.com/en-us/library/cc907080(v=VS.85).aspx

    Best regards,
    Łukasz

    • Marked as answer by David Jones MVP Wednesday, February 16, 2011 10:19 PM
    Wednesday, February 16, 2011 5:14 PM
  • Wrt Q3  I meant from within the task code not from the app launching the job.

    Thanks for the information.

     


    DJaus Snr SW Dev (Embedded Systems and .NET)
    Wednesday, February 16, 2011 10:22 PM
  • Program running as a task can also use the same APIs to connect back to the scheduler. Headnode hostname needed for connection can be taken from CCP_SCHEDULER env variable.

    Wednesday, February 16, 2011 10:45 PM
  • Thanks, that makes it all quite clear.

    I couldn't see such a definitive statement in the documentation.

    Cheers


    DJaus Snr SW Dev (Embedded Systems and .NET)
    Wednesday, February 16, 2011 10:50 PM