Get walltime in a PBS job script

后端 未结 2 1935
我寻月下人不归
我寻月下人不归 2021-01-18 03:02

When submitting a job script to a PBS queuing system, a walltime is specified automatically or by the user e.g. via

#PBS -l walltime=1:00:00
相关标签:
2条回答
  • 2021-01-18 03:25

    This is stored in the environment variable $PBS_WALLTIME.

    Of course, that is for TORQUE, I'm not sure which PBS queuing system you are using.

    0 讨论(0)
  • 2021-01-18 03:32

    I was looking for an answer to this and the comments above gave me an idea that seems to work pretty well. You can use qstat and grab the pertinent information from it with sed:

    qstat -f $PBS_JOBID | sed -rn 's/.*Resource_List.walltime = (.*)/\1/p'
    

    Putting this in your PBS script will print out the value and you can use standard bash to store the output of this in a variable:

    WALLTIME=$(qstat -f $PBS_JOBID | sed -rn 's/.*Resource_List.walltime = (.*)/\1/p')
    

    You can also use this to get other information that is not available from the PBS_* environment variables such as the amount of memory allocated for the job and probably some other stuff.

    0 讨论(0)
提交回复
热议问题