Scripts

Job Directory Script

A script to print the directory that a job is running in.

usage: job_dir.py [-h] job_id

Positional Arguments

job_id

The ID number of the job

qdir alias to cd to job’s directory

This script to print the job directory can be used in combination with bash aliases to create a qdir alias for moving to the directory a job is running in

qdirfun() { cd `job_dir.py $1`;}
alias qdir=qdirfun

Then in the shell instance you can do qdir {job_id} to move the job’s run directory.

Qdel for User Jobs Script

A script to delete active PBS jobs of the current user. The list of jobs to be deleted can be filtered by id range, job name substring, and queue. For safety, the default behavior is to show the user which jobs will be deleted and ask for confirmation before any jobs are deleted.

usage: qdel_user_jobs.py [-h] [--id_range ID_RANGE ID_RANGE] [--queue QUEUE] [--name NAME] [--confirm] [--no-confirm]

Named Arguments

--id_range

Delete jobs in a range of id numbers, [min id, max id]

Default: (-1, -1)

--queue

Delete jobs in a specific queue

Default: “”

--name

Delete jobs in a specific string in the name

Default: “”

--confirm

Whether to prompt the user for confirmation of before deleting

Default: True

--no-confirm

Default: True

Example

The following command would delete the current users jobs that meet these conditions: PBS ids between 1000 and 2400, in the K3-standard queue, and have crm in the job name. By default the list of jobs will be printed to the screen asking the user for confirmation. Add --no-confirm would skip this step.

qdel_user_jobs.py --id_range 1000 2400 --queue K3-standard --name crm