Submit sbatch jobs without having to create a submission script
This project is motivated by the fact that I want to just be able to submit commands as jobs and I don't want to fluff around with making a submission script.
ssubmit
wraps that whole process and lets you live your best lyf #blessed.
Run this little scriptlet or download for you system from the releases page.
shell
VERSION="0.1.0" # ssubmit version you want
OS=$(uname -s)
if [ "$OS" = "Linux" ]; then
triple="x86_64-unknown-linux-musl"
elif [ "$OS" = "Darwin" ]; then
triple="x86_64-apple-darwin"
else
echo "ERROR: $OS not a recognised operating system"
fi
if [ -n "$triple" ]; then
URL="https://github.com/mbhall88/ssubmit/releases/download/${VERSION}/ssubmit-${VERSION}-${triple}.tar.gz"
wget "$URL" -O - | tar -xzf -
./ssubmit --help
fi
shell
$ cargo install ssubmit
shell
$ git clone https://github.com/mbhall88/ssubmit.git
$ cd ssubmit
$ cargo build --release
$ target/release/ssubmit -h
Submit an rsync job named "foo" and request 350MB of memory and a one week time limit
shell
$ ssubmit -m 350m -t 1w foo "rsync -az src/ dest/"
Submit a job that needs 8 CPUs
shell
$ ssubmit -m 16g -t 1d align "minimap2 -t 8 ref.fa query.fq > out.paf" -- -c 8
The basic anatomy of a ssubmit
call is
ssubmit [OPTIONS] <NAME> <COMMAND> [-- <REMAINDER>...]
NAME
is the name of the job (the --job-name
parameter in sbatch
).
COMMAND
is what you want to be executed by the job. It must be quoted (siungle or
double).
REMAINDER
is any (optional) sbatch
-specific parameters you want to pass on. These
must follow a --
after COMMAND
.
Memory (-m,--mem
) is intended to be a little more user-friendly than the sbatch
--mem
option. For example, you can pass -m 0.5g
and ssubmit
will interpret and
convert this as 500M. However, -m 1.7G
will be rounded up to 2G. One place where this
option differs from sbatch
is that if you don't give units, it will be interpreted as
bytes - i.e., -m 1000
will be converted to 1K. Units are case insensitive.
As with memory, time (-t,--time
) is intended to be simple. If you want a time limit of
three days, then just pass -t 3d
. Want two and a half hours? Then -t 2h30m
works. If
you want to just use the default limit of your cluster, then just pass -t 0
. You can
also just pass the time format sbatch
uses and this will be seamlessly passed on. For
a full list of support time units, check out the
duration-str
repo.
You can see what ssubmit
would do without actually submitting a job using dry run
(-n,--dry-run
). This will print the sbatch
command and also the submission script
that would have been provided.
```shell $ ssubmit -n -m 4g -t 1d dry "rsync -az src/ dest/" -- -c 8 [2022-01-19T08:58:58Z INFO ssubmit] Dry run requested. Nothing submitted sbatch -c 8