Run your batch jobs in containers, created dynamically at run time. Without changes to your jobs.
https://asciinema.org/a/e9gfcdnbrt5e6hb1jor5lp8x8
You can download and compile the project with:
$ go get github.com/cbatchx/cbatch
$ cd $GOPATH/src/github.com/cbatchx/cbatch
$ glide install
$ go build
After building you can run it on a torque cluster provided by vagrant.
Download .tar file from releases section of github.
$ sudo mkdir -p /var/lib/cbatch
$ sudo tar -xvf cbatch-0.0.6-amd64linux.tar -C /var/lib/cbatch
Edit /var/lib/cbatch/config/config.toml
to fit your system.
Add $jobstarter
option to your Torque mom config.
$ echo '$job_starter /var/lib/cbatch/cbatch' >> /var/lib/torque/mom_priv/config
$ echo '$job_starter_run_privileged true' >> /var/lib/torque/mom_priv/config
$ sudo systemctl restart pbs_mom # On centos7 use what fits your system.
- Docker installed locally
In this mode you simply give cbatch some environment variables to "mock" a submitted torque job.
To run cbatch without Torque some environment variables must be "mocked".
PBS_O_LOGNAME
must be set to a user on the system.PBS_O_HOME
must be set to the home directory of the user.PBS_JOBID
must be set to the name of one of the jobs intest/jobs
without .SC
The config.toml file must also be configured to make it run. See the config/config.toml
You must also supply which shell to run the job as and the job as parameters to cbatch as Torque normally supplies cbatch with these.
$ go build
$ PBS_O_LOGNAME=$USER PBS_O_HOME=$HOME PBS_JOBID=hello ./cbatch /bin/bash `pwd`/test/jobs/hello.SC
You can also make the job interactive by running (you will end up with a shell in the container): $ PBS_O_LOGNAME=$USER PBS_O_HOME=$HOME PBS_JOBID=hello PBS_ENVIRONMENT=PBS_INTERACTIVE ./cbatch /bin/bash
- Vagrant https://www.vagrantup.com/
The following command builds a three part virtual Torque cluster with 1 master host and 2 slaves.
$ NODES=2 vagrant up
NODES
defines the number of slave nodes that will be created for the cluster.
$ vagrant ssh master
$ echo 'echo "Hello Docker"' | qsub
You can also ssh into slave1
, slave2
etc. to look at the logs.
$ NODES=2 vagrant suspend
$ NODES=2 vagrant destroy
Vagrant setup is built upon crcollins/torquecluster