Giter Site home page Giter Site logo

new_job_hpc's Introduction

new_job.py

Python program to create UofA HPC jobs.

Description

The script "new_job.py" has been created with the goal to automate the creation of HPC job submission files.

Job submission files for the UofA HPC system can be created for the SLURM or the PBS systems. See more in the HPC wiki

If run with -h|--help new_job.py produces the following:

$ ./new_job.py -h
usage: new_job.py [-h] [-s str] [-n str] [-g str] [-re str] [-e EMAIL] [-p str] [-nt str] [-nn str]
                  [-m str] [-t str] [-d str] [-f]
                  job

Create a HPC job template

positional arguments:
  job                   Job name

optional arguments:
  -h, --help            show this help message and exit
  -s str, --system str  The system you would like to create the job for (default: slurm)
  -n str, --name str    Name you want to give the file and the job (default: new_job)
  -g str, --group str   The group to assign the job to (default: barberan)
  -re str, --request_email str
                        Mail intensity you want to request (default: ALL)
  -e EMAIL, --email EMAIL
                        Email for docstring (default: [email protected])
  -p str, --partition str
                        The system you would like to create the job for (default: standard)
  -nt str, --ntasks str
                        The number of cores used for this job (default: 1)
  -nn str, --nodes str  Number of nodes used for this job (default: 1)
  -m str, --memory str  Memory required for this job (default: 1gb)
  -t str, --time str    The time required for this job (hhh:mm:ss) (default: 1:00:00)
  -d str, --outdir str  Directory where you would like the job to be created (default: jobs)
  -f, --force           Overwrite existing (default: False)

The only required argument is the positional job, which takes the name you want to give the job file.

If run with default settings new_job.py will produce the following SLURM template:

$ ./new_job.py foo.slurm
SLURM job has been created!
$ less ./jobs/foo.slurm
#!/usr/bin/bash
# --------------------------------------------------
# Request resources here
# --------------------------------------------------
#SBATCH --job-name=new_job
#SBATCH --output=new_job.out
#SBATCH --account=barberan
#SBATCH --mail-type=ALL
#SBATCH [email protected]
#SBATCH --partition=standard
#SBATCH --ntasks=1
#SBATCH --nodes=1
#SBATCH --mem=1gb
#SBATCH --time=None

# --------------------------------------------------
# Load modules here
# --------------------------------------------------

# --------------------------------------------------
# Execute commands here
# --------------------------------------------------

This template will be created as a file, which can be stored in a personalized directory specified using the -d flag (default: jobs).

Defaults:

This script has been made to make my life easier, some default values (e.g. group = barberan and email) are convenient for me but might not be convenient for other users.

You can change the default values of arguments in the get_args() and get_defaults() functions to those that best suit you.

Overwrite:

The script will check if the file name you give it exists. If you don't give it initial instructions on wether it should overwrite a pre-existing file using the flag -f --force, then the script will ask you if you would like to overwrite:

$ ./new_job.py foo.slurm
"jobs/foo.slurm" exists.  Overwrite? [yN] y
SLURM job has been created!

Author

Mery Touceda-Suárez: [email protected]

new_job_hpc's People

Contributors

merytouceda avatar kyclark avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.