Execute shell command lines in parallel on Slurm, S(on) of Grid Engine (SGE), PBS/Torque clusters

Related tags

CLI Tools qbatch
Overview

qbatch

Execute shell command lines in parallel on Slurm, S(on) of Grid Engine (SGE), PBS/Torque clusters

Travis CI build status

qbatch is a tool for executing commands in parallel across a compute cluster. It takes as input a list of commands (shell command lines or executable scripts) in a file or piped to qbatch. The list of commands are divided into arbitrarily sized chunks which are submitted as jobs to the cluster either as individual submissions or an array. Each job runs the commands in its chunk in parallel according to cores. Commands can also be run locally on systems with no cluster capability via gnu-paralel.

qbatch can also be used within python using the qbatch.qbatchParser and qbatch.qbatchDriver functions. qbatchParser will accept a list of command line options identical to the shell interface, parse, and submit jobs. The qbatchDriver interface will accept key-value pairs corresponding to the outputs of the argument parser, and additionally, the task_list option, providing a list of strings of commands to run.

Installation

$ pip install qbatch

Dependencies

qbatch requires python (>2.7) and GNU Parallel. For Torque/PBS and gridengine clusters, qbatch requires the qsub and qstat commands. For Slurm workload manager, qbatch requires the sbatch and squeue commands.

Environment variable defaults

qbatch supports several environment variables to customize defaults for your local system.

$ export QBATCH_PPJ=12                   # requested processors per job
$ export QBATCH_CHUNKSIZE=$QBATCH_PPJ    # commands to run per job
$ export QBATCH_CORES=$QBATCH_PPJ        # commonds to run in parallel per job
$ export QBATCH_NODES=1                  # number of compute nodes to request for the job, typically for MPI jobs
$ export QBATCH_MEM="0"                  # requested memory per job
$ export QBATCH_MEMVARS="mem"            # memory request variable to set
$ export QBATCH_SYSTEM="pbs"             # queuing system to use ("pbs", "sge","slurm", or "local")
$ export QBATCH_NODES=1                  # (PBS-only) nodes to request per job
$ export QBATCH_SGE_PE="smp"             # (SGE-only) parallel environment name
$ export QBATCH_QUEUE="1day"             # Name of submission queue
$ export QBATCH_OPTIONS=""               # Arbitrary cluster options to embed in all jobs
$ export QBATCH_SCRIPT_FOLDER=".qbatch/" # Location to generate jobfiles for submission
$ export QBATCH_SHELL="/bin/sh"          # Shell to use to evaluate jobfile

Command line help

usage: qbatch [-h] [-w WALLTIME] [-c CHUNKSIZE] [-j CORES] [--ppj PPJ]
              [-N JOBNAME] [--mem MEM] [-q QUEUE] [-n] [-v] [--version]
              [--depend DEPEND] [-d WORKDIR] [--logdir LOGDIR] [-o OPTIONS]
              [--header HEADER] [--footer FOOTER] [--nodes NODES]
              [--sge-pe SGE_PE] [--memvars MEMVARS]
              [--pbs-nodes-spec PBS_NODES_SPEC] [-i]
              [-b {pbs,sge,slurm,local,container}] [--env {copied,batch,none}]
              [--shell SHELL]
              ...

Submits a list of commands to a queueing system. The list of commands can be
broken up into 'chunks' when submitted, so that the commands in each chunk run
in parallel (using GNU parallel). The job script(s) generated by qbatch are
stored in the folder .qbatch/

positional arguments:
  command_file          An input file containing a list of shell commands to
                        be submitted, - to read the command list from stdin or
                        -- followed by a single command

optional arguments:
  -h, --help            show this help message and exit
  -w WALLTIME, --walltime WALLTIME
                        Maximum walltime for an array job element or
                        individual job (default: None)
  -c CHUNKSIZE, --chunksize CHUNKSIZE
                        Number of commands from the command list that are
                        wrapped into each job (default: 1)
  -j CORES, --cores CORES
                        Number of commands each job runs in parallel. If the
                        chunk size (-c) is smaller than -j then only chunk
                        size commands will run in parallel. This option can
                        also be expressed as a percentage (e.g. 100%) of the
                        total available cores (default: 1)
  --ppj PPJ             Requested number of processors per job (aka ppn on
                        PBS, slots on SGE, cpus per task on SLURM). Cores can
                        be over subscribed if -j is larger than --ppj (useful
                        to make use of hyper-threading on some systems)
                        (default: 1)
  -N JOBNAME, --jobname JOBNAME
                        Set job name (defaults to name of command file, or
                        STDIN) (default: None)
  --mem MEM             Memory required for each job (e.g. --mem 1G). This
                        value will be set on each variable specified in
                        --memvars. To not set any memory requirement, set this
                        to 0 (default: 0)
  -q QUEUE, --queue QUEUE
                        Name of queue to submit jobs to (defaults to no queue)
                        (default: None)
  -n, --dryrun          Dry run; Create jobfiles but do not submit or run any
                        commands (default: False)
  -v, --verbose         Verbose output (default: False)
  --version             show program's version number and exit

advanced options:
  --depend DEPEND       Wait for successful completion of job(s) with name
                        matching given glob pattern or job id matching given
                        job id(s) before starting (default: None)
  -d WORKDIR, --workdir WORKDIR
                        Job working directory (default:
                        current working directory)
  --logdir LOGDIR       Directory to save store log files (default:
                        {workdir}/logs)
  -o OPTIONS, --options OPTIONS
                        Custom options passed directly to the queuing system
                        (e.g --options "-l vf=8G". This option can be given
                        multiple times (default: [])
  --header HEADER       A line to insert verbatim at the start of the script,
                        and will be run once per job. This option can be given
                        multiple times (default: None)
  --footer FOOTER       A line to insert verbatim at the end of the script,
                        and will be run once per job. This option can be given
                        multiple times (default: None)
  --nodes NODES         (PBS and SLURM only) Nodes to request per job
                        (default: 1)
  --sge-pe SGE_PE       (SGE-only) The parallel environment to use if more
                        than one processor per job is requested (default: smp)
  --memvars MEMVARS     A comma-separated list of variables to set with the
                        memory limit given by the --mem option (e.g.
                        --memvars=h_vmem,vf) (default: mem)
  --pbs-nodes-spec PBS_NODES_SPEC
                        (PBS-only) String to be inserted into nodes= line of
                        job (default: None)
  -i, --individual      Submit individual jobs instead of an array job
                        (default: False)
  -b {pbs,sge,slurm,local,container}, --system {pbs,sge,slurm,local,container}
                        The type of queueing system to use. 'pbs' and 'sge'
                        both make calls to qsub to submit jobs. 'slurm' calls
                        sbatch. 'local' runs the entire command list (without
                        chunking) locally. 'container' creates a joblist and
                        metadata file, to pass commands out of a container to
                        a monitoring process for submission to a batch system.
                        (default: local)
  --env {copied,batch,none}
                        Determines how your environment is propagated when
                        your job runs. "copied" records your environment
                        settings in the job submission script, "batch" uses
                        the cluster's mechanism for propagating your
                        environment, and "none" does not propagate any
                        environment variables. (default: copied)
  --shell SHELL         Shell to use for spawning jobs and launching single
                        commands (default: /bin/sh)

Some examples:

# Submit an array job from a list of commands (one per line)
# Generates a job script in ./.qbatch/ and job logs appear in ./logs/\
# All defaults are inherited from QBATCH_* environment variables
$ qbatch commands.txt

# Submit a single command to the cluster
$ qbatch -- echo hello

# Set the walltime for each job
$ qbatch -w 3:00:00 commands.txt

# Run 24 commands per job
$ qbatch -c24 commands.txt

# Pack 24 commands per job, run 12 in parallel at a time
$ qbatch -c24 -j12 commands.txt

# Start jobs after successful completion of existing jobs with names starting with "stage1_"
$ qbatch --afterok 'stage1_*' commands.txt

# Pipe a list of commands to qbatch
$ parallel echo process.sh {} ::: *.dat | qbatch -

# Run jobs locally with GNU Parallel, 12 commands in parallel
$ qbatch -b local -j12 commands.txt

# Many options don't make sense locally: chunking, individual vs array, nodes,
# ppj, highmem, and afterok are ignored

A python script example:

# Submit jobs to a cluster using the QBATCH_* environment defaults
import qbatch
task_list = ['echo hello', 'echo hello2']
qbatch.qbatchDriver(task_list = task_list)
Comments
  • Syntax error near unexpected token '(' from export of BASH_FUNC_module()

    Syntax error near unexpected token '(' from export of BASH_FUNC_module()

    Hey guys,

    My jobs finish with the following error message:

    /var/spool/torque/mom_priv/jobs/35134401-1.gpc-sched-ib0.SC: line 102: syntax error near unexpected token `('
    /var/spool/torque/mom_priv/jobs/35134401-1.gpc-sched-ib0.SC: line 102: `export BASH_FUNC_module()="() {  if [ \"$$1\" = load ]; then'
    

    Here is what the .array script looked like...

    #!/bin/bash
    #PBS -l nodes=1:ppn=8
    #PBS -j oe
    #PBS -o /bg01/homescinet/a/arisvoin/edickie/myscripts/abide/logs
    #PBS -d /bg01/homescinet/a/arisvoin/edickie/myscripts/abide
    #PBS -N Caltech
    #PBS 
    #PBS -t 1-7
    #PBS -l walltime=2:00:00
    #PBS 
    #PBS 
    # -- start copied env
    export scratch="/scratch/a/arisvoin/edickie"
    export MODULESHOME="/scinet/gpc/Modules6/Modules/3.2.9"
    export MKLPATH="/scinet/gpc/intel/ics/composer_xe_2013_sp1.1.106/mkl/lib/intel64"
    export HCP_DATA="/scratch/a/arisvoin/edickie/ABIDE/hcp"
    export SHELL="/bin/bash"
    export HISTSIZE="1000"
    export HCPPIPEDIR_tfMRIAnalysis="/home/a/arisvoin/edickie/quarantine//hcp-pipelines/3.13.1/build//TaskfMRIAnalysis/scripts"
    export MANPATH="/scinet/gpc/mpi/openmpi/1.4.4-intel-v12.1/share/man:/scinet/gpc/intel/ics/composer_xe_2013_sp1.1.106/man/en_US:/scinet/gpc/tools/editors/nano/nano-2.2.4/share/man:/scinet/gpc/x11/6/man:/usr/local/share/man:/usr/share/man:/scinet/gpc/man:/scinet/gpc/Modules6/Modules/3.2.9/man:/scinet/gpc/man/:/usr/local/share/man:/usr/share/man:/scinet/gpc/man:/scinet/gpc/toolbin/x11/man:/scinet/gpc/man/:/scinet/gpc/Modules6/Modules/3.2.9/man:/scinet/gpc/man/:/scinet/gpc/share/man:/scinet/gpc/tools/gnuparallel/20140622/share/man"
    export HCPPIPEDIR_Global="/home/a/arisvoin/edickie/quarantine//hcp-pipelines/3.13.1/build//global/scripts"
    export MKL_F95_MOD_ROOT="/scinet/gpc/intel/ics/composer_xe_2013_sp1.1.106/mkl/include/intel64"
    export FSLOUTPUTTYPE="NIFTI_GZ"
    export PYTHONPATH="/scinet/gpc/mpi/mpi4py/centos6/python2.7/openmpi-intel-1.4.x/lib/python2.7/site-packages/:/home/a/arisvoin/edickie/code/epitome/:/home/a/arisvoin/edickie/code/epitome/"
    export FPATH="/scinet/gpc/intel/ics/composer_xe_2013_sp1.1.106/mkl/include"
    export MIC_LIBRARY_PATH="/scinet/gpc/intel/ics/composer_xe_2013_sp1.1.106/tbb/lib/mic"
    export GS_LIB="/scinet/gpc/x11/6/share/ghostscript/8.70/Resource/Init:/scinet/gpc/x11/6/share/ghostscript/8.70/Resource/Font:/scinet/gpc/x11/6/share/ghostscript/8.70/lib:/scinet/gpc/x11/6/fonts/default/ghostscript"
    export PARALLEL="--workdir . --env PATH --env LD_LIBRARY_PATH --env LOADEDMODULES --env _LMFILES_ --env MODULE_VERSION --env MODULEPATH --env MODULEVERSION_STACK --env MODULESHOME --env OMP_DYNAMICS --env OMP_MAX_ACTIVE_LEVELS --env OMP_NESTED --env OMP_NUM_THREADS --env OMP_SCHEDULE --env OMP_STACKSIZE --env OMP_THREAD_LIMIT --env OMP_WAIT_POLICY"
    export SCREENDIR="/scratch/a/arisvoin/edickie/.screen_run/"
    export SCINET_X11_INC="/scinet/gpc/x11/6/include"
    export HCPPIPEDIR_fMRIVol="/home/a/arisvoin/edickie/quarantine//hcp-pipelines/3.13.1/build//fMRIVolume/scripts"
    export VOLUME_CACHE_THRESHOLD="-1"
    export MKLROOT="/scinet/gpc/intel/ics/composer_xe_2013_sp1.1.106/mkl/lib/intel64"
    export CXX="icpc"
    export FSLGECUDAQ="cuda.q"
    export HOSTNAME="gpc-f103n084-ib0"
    export HCPPIPEDIR_PreFS="/home/a/arisvoin/edickie/quarantine//hcp-pipelines/3.13.1/build//PreFreeSurfer/scripts"
    export MNI_DATAPATH="/scratch/project/t/tpaus/tpaus/FREESURFER/freesurfer/mni/data"
    export MNI_DIR="/scratch/project/t/tpaus/tpaus/FREESURFER/freesurfer/mni"
    export MAIL="/var/spool/mail/edickie"
    export HCPPIPEDIR_PostFS="/home/a/arisvoin/edickie/quarantine//hcp-pipelines/3.13.1/build//PostFreeSurfer/scripts"
    export OS="Linux"
    export FS_OVERRIDE="0"
    export SCINET_MPI_LIB="/scinet/gpc/mpi/openmpi/1.4.4-intel-v12.1/lib"
    export GROUP="arisvoin"
    export LESSOPEN="|/usr/bin/lesspipe.sh %s"
    export FSLTCLSH="/home/a/arisvoin/edickie/quarantine//FSL/5.0.9/build/bin/fsltclsh"
    export CPATH="/scinet/gpc/intel/ics/composer_xe_2013_sp1.1.106/tbb/include:/scinet/gpc/intel/ics/composer_xe_2013_sp1.1.106/mkl/include"
    export USER="edickie"
    export FSL_BIN="/home/a/arisvoin/edickie/quarantine//FSL/5.0.9/build/bin"
    export MODULE_VERSION_STACK="3.2.9"
    export FMRI_ANALYSIS_DIR="/scratch/project/t/tpaus/tpaus/FREESURFER/freesurfer/fsfast"
    export SCINET_TBB_INC="/scinet/gpc/intel/ics/composer_xe_2013_sp1.1.106/tbb/include"
    export HCPPIPEDIR_Templates="/home/a/arisvoin/edickie/quarantine//hcp-pipelines/3.13.1/build//global/templates"
    export SHLVL="1"
    export SCINET_INTERACTIVE="1"
    export EPITOME_DATA="/scratch/a/arisvoin/edickie/ABIDE/epi-fixtrain"
    export MIC_LD_LIBRARY_PATH="/scinet/gpc/intel/ics/composer_xe_2013_sp1.1.106/tbb/lib/mic:/opt/intel/mic/coi/device-linux-release/lib:/opt/intel/mic/myo/lib:/scinet/gpc/intel/ics/composer_xe_2013_sp1.1.106/compiler/lib/mic:/scinet/gpc/intel/ics/composer_xe_2013_sp1.1.106/mpirt/lib/mic:/scinet/gpc/intel/ics/composer_xe_2013_sp1.1.106/mkl/lib/mic"
    export FREESURFER_HOME="/scratch/project/t/tpaus/tpaus/FREESURFER/freesurfer"
    export SCINET_X11_LIB="/scinet/gpc/x11/6/lib"
    export CVSROOT="/usr/local/cvsroot"
    export SCINET_NANO_BASE="/scinet/gpc/tools/editors/nano/nano-2.2.4"
    export ENV="/home/a/arisvoin/edickie/.bashrc"
    export BASH_ENV="/home/a/arisvoin/edickie/.bashrc"
    export _="/home/a/arisvoin/edickie/code/qbatch/bin/qbatch"
    export MODULEPATH="/scinet/gpc/Modules6/Modules/versions:/scinet/gpc/Modules6/Modules/$$MODULE_VERSION/modulefiles:/scinet/gpc/Modules6/Modules/modulefiles:/home/t/tpaus/tpaus/privatemodules:/home/a/arisvoin/edickie/quarantine/modules:/home/a/arisvoin/edickie/quarantine//modules"
    export PERL5LIB="/scratch/project/t/tpaus/tpaus/FREESURFER/freesurfer/mni/lib/perl5/5.8.5:/scratch/project/t/tpaus/tpaus/FREESURFER/freesurfer/mni/lib/perl5/5.8.5:/home/t/tpaus/tpaus/opt/minc/perl/lib/perl5/site_perl/5.8.8:"
    export SCINET_FONTPATH="/scinet/gpc/x11/6/fonts/largerset"
    export SSH_CONNECTION="172.20.82.14 38764 172.20.250.251 22"
    export FSLMULTIFILEQUIT="TRUE"
    export FIX_VERTEX_AREA=""
    export HCPPIPEDIR_FS="/home/a/arisvoin/edickie/quarantine//hcp-pipelines/3.13.1/build//FreeSurfer/scripts"
    export PBS_DEFAULT="gpc-sched-ib0"
    export HCPPIPEDIR_fMRISurf="/home/a/arisvoin/edickie/quarantine//hcp-pipelines/3.13.1/build//fMRISurface/scripts"
    export SUBJECTS_DIR="/scratch/a/arisvoin/edickie/ABIDE/FSout"
    export _LMFILES_="/scinet/gpc/Modules6/Modules/modulefiles/extras/64_6.4:/scinet/gpc/Modules6/Modules/modulefiles/Xlibraries/X11-64:/scinet/gpc/Modules6/Modules/modulefiles/ImageMagick/6.6.7:/scinet/gpc/Modules6/Modules/modulefiles/nano/2.2.4:/scinet/gpc/Modules6/Modules/modulefiles/intel/14.0.1:/scinet/gpc/Modules6/Modules/modulefiles/openmpi/1.4.4-intel-v12.1:/scinet/gpc/Modules6/Modules/modulefiles/gnu-parallel/20140622:/home/a/arisvoin/edickie/quarantine/modules/edickie_quarantine:/home/a/arisvoin/edickie/quarantine/modules/FSL/5.0.9:/home/a/arisvoin/edickie/quarantine/modules/AFNI/2015.12.15:/home/a/arisvoin/edickie/quarantine/modules/FIX/1.06:/home/a/arisvoin/edickie/quarantine/modules/connectome-workbench/1.1.1:/home/a/arisvoin/edickie/quarantine/modules/hcp-pipelines/3.13.1:/home/a/arisvoin/edickie/quarantine/modules/python/2.7.11-Anaconda2-2.5.0"
    export HCPPIPEDIR_dMRITract="/home/a/arisvoin/edickie/quarantine//hcp-pipelines/3.13.1/build//DiffusionTractography/scripts"
    export MKL_HOME="/scinet/gpc/intel/ics/composer_xe_2013_sp1.1.106/mkl"
    export MODULE_VERSION="3.2.9"
    export FSLDISPLAY="/usr/bin/display"
    export INTEL_LICENSE_FILE="/scinet/gpc/intel/licenses"
    export HCPPIPEDIR_dMRI="/home/a/arisvoin/edickie/quarantine//hcp-pipelines/3.13.1/build//DiffusionPreprocessing/scripts"
    export SCINET_VIZ="0"
    export FC="ifort"
    export HOME="/home/a/arisvoin/edickie"
    export HCPPIPEDIR_Config="/home/a/arisvoin/edickie/quarantine//hcp-pipelines/3.13.1/build//global/config"
    export LD_LIBRARY_PATH="/scinet/gpc/mpi/openmpi/1.4.4-intel-v12.1/lib/openmpi:/scinet/gpc/mpi/openmpi/1.4.4-intel-v12.1/lib:/scinet/gpc/intel/ics/composer_xe_2013_sp1.1.106/tbb/lib/intel64:/scinet/gpc/x11/6/lib:/scinet/gpc/toolbin/x11/lib:/scinet/gpc/lib64_6.4:/scinet/gpc/lib64_6.4/mysql:/scinet/gpc/intel/ics/composer_xe_2013_sp1.1.106/compiler/lib/intel64:/scinet/gpc/intel/ics/composer_xe_2013_sp1.1.106/debugger/lib/intel64:/scinet/gpc/intel/ics/composer_xe_2013_sp1.1.106/mkl/lib/intel64:/opt/intel/mic/coi/host-linux-release/lib:/opt/intel/mic/myo/lib"
    export LANG="C"
    export LIBRARY_PATH="/scinet/gpc/intel/ics/composer_xe_2013_sp1.1.106/tbb/lib/intel64:/scinet/gpc/lib64_6.4:/scinet/gpc/lib64_6.4/mysql:/scinet/gpc/intel/ics/composer_xe_2013_sp1.1.106/compiler/lib/intel64:/scinet/gpc/intel/ics/composer_xe_2013_sp1.1.106/debugger/lib/intel64:/scinet/gpc/intel/ics/composer_xe_2013_sp1.1.106/mkl/lib/intel64"
    export FSF_OUTPUT_FORMAT="nii.gz"
    export SCINET_OTPO_BASE="/scinet/gpc/mpi/openmpi/otpo/1.0.0/"
    export NLSPATH="/scinet/gpc/intel/ics/composer_xe_2013_sp1.1.106/compiler/lib/intel64/locale/en_US"
    export G_BROKEN_FILENAMES="1"
    export SCINET_EXTRAS_INC="/scinet/gpc/include6"
    export SCINET_JOBID=""
    export SCINET_INTEL_BASE="/scinet/gpc/intel/ics/composer_xe_2013_sp1.1.106/"
    export MSMBin="/home/a/arisvoin/edickie/quarantine//hcp-pipelines/3.13.1/build//MSMBinaries"
    export CC="icc"
    export SINK_LD_LIBRARY_PATH="/scinet/gpc/intel/ics/composer_xe_2013_sp1.1.106/compiler/lib/mic:/scinet/gpc/intel/ics/composer_xe_2013_sp1.1.106/mkl/lib/mic:/scinet/gpc/intel/ics/composer_xe_2013_sp1.1.106/mpirt/lib/mic"
    export SCINET_TBB_LIB="/scinet/gpc/intel/ics/composer_xe_2013_sp1.1.106/tbb/lib/intel64"
    export TBBROOT="/scinet/gpc/intel/ics/composer_xe_2013_sp1.1.106/tbb"
    export BASH_FUNC_module()="() {  if [ \"$$1\" = load ]; then
     shift;
     for each_module in $$*;
     do
     eval `/scinet/gpc/Modules6/Modules/3.2.9/bin/modulecmd bash load $$each_module`;
     done;
     unset each_module;
     else
     if [ \"$$1\" = advice ]; then
     shift;
     /scinet/gpc/bin6/moduleadvice $$*;
     else
     if [ \"$$1\" = find ]; then
     shift;
     /scinet/gpc/bin6/modulefind $$*;
     else
     eval `/scinet/gpc/Modules6/Modules/3.2.9/bin/modulecmd bash $$*`;
     fi;
     fi;
     fi
    }"
    export SCINETVIZDONE="1"
    export F77="ifort"
    export SSH_TTY="/dev/pts/19"
    export QUARANTINE_ENV="scinet"
    export SCINET_X11_BIN="/scinet/gpc/x11/6/bin"
    export GDB_CROSS="/scinet/gpc/intel/ics/composer_xe_2013_sp1.1.106/debugger/gdb/intel64_mic/py26/bin/gdb-mic"
    export CVS_RSH="ssh"
    export SCINET_INTEL_INC="/scinet/gpc/intel/ics/composer_xe_2013_sp1.1.106/compiler/include"
    export LOCAL_DIR="/scratch/project/t/tpaus/tpaus/FREESURFER/freesurfer/local"
    export CARET7DIR="/home/a/arisvoin/edickie/quarantine//connectome-workbench/1.1.1/build/bin_rh_linux64"
    export FSLCONVERT="/usr/bin/convert"
    export FSLDIR="/home/a/arisvoin/edickie/quarantine//FSL/5.0.9/build"
    export MKL="/scinet/gpc/intel/ics/composer_xe_2013_sp1.1.106/mkl/"
    export SCINET_EXTRAS_LIB="/scinet/gpc/lib64_6.4"
    export SSH_CLIENT="172.20.82.14 38764 22"
    export LOGNAME="edickie"
    export PATH="/scratch/project/t/tpaus/tpaus/FREESURFER/freesurfer/bin:/scratch/project/t/tpaus/tpaus/FREESURFER/freesurfer/fsfast/bin:/scratch/project/t/tpaus/tpaus/FREESURFER/freesurfer/tktools:/home/a/arisvoin/edickie/quarantine//FSL/5.0.9/build/bin:/scratch/project/t/tpaus/tpaus/FREESURFER/freesurfer/mni/bin:/home/a/arisvoin/edickie/quarantine//python/2.7.11-Anaconda2-2.5.0/build/bin:/home/a/arisvoin/edickie/quarantine//connectome-workbench/1.1.1/build/bin_rh_linux64:/home/a/arisvoin/edickie/quarantine//FIX/1.06/build:/home/a/arisvoin/edickie/quarantine//AFNI/2015.12.10/build:/home/a/arisvoin/edickie/quarantine//FSL/5.0.9/build/bin:/scratch/project/t/tpaus/tpaus/FREESURFER/freesurfer/bin:/scratch/project/t/tpaus/tpaus/FREESURFER/freesurfer/fsfast/bin:/scratch/project/t/tpaus/tpaus/FREESURFER/freesurfer/tktools:/scratch/project/t/tpaus/tpaus/FREESURFER/freesurfer/mni/bin:/scinet/gpc/mpi/openmpi/otpo/1.0.0//bin:/scinet/gpc/mpi/openmpi/1.4.4-intel-v12.1/bin:/scinet/gpc/intel/ics/composer_xe_2013_sp1.1.106/bin/intel64:/scinet/gpc/graphics/ffmpeg-0.8.2-centos6/bin:/scinet/gpc/graphics/ImageMagick-6.6.7-7-centos6/bin:/scinet/gpc/x11/6/bin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/scinet/gpc/toolbin:/scinet/gpc/toolbin/vnc:/scinet/gpc/toolbin/x11/bin:/usr/lpp/mmfs/bin:/opt/torque/bin:/opt/torque/sbin:/scinet/gpc/bin6:/scinet/gpc/x11/6/bin/old:/scinet/gpc/tools/editors/nano/nano-2.2.4/bin:/scinet/gpc/intel/ics/composer_xe_2013_sp1.1.106/bin/intel64_mic:/scinet/gpc/intel/ics/composer_xe_2013_sp1.1.106/debugger/gdb/intel64_mic/py26/bin:/opt/intel/mic/bin:/scinet/gpc/tools/gnuparallel/20140622/bin:/home/a/arisvoin/edickie/code/epitome/bin:/home/a/arisvoin/edickie/code/epitome/bin"
    export SCINET_INTEL_LIB="/scinet/gpc/intel/ics/composer_xe_2013_sp1.1.106/compiler/lib/intel64"
    export TERM="xterm"
    export FSL_DIR="/home/a/arisvoin/edickie/quarantine//FSL/5.0.9/build"
    export MNI_PERL5LIB="/scratch/project/t/tpaus/tpaus/FREESURFER/freesurfer/mni/lib/perl5/5.8.5"
    export EPITOME_CLONE="/home/a/arisvoin/edickie/epi-clone"
    export FSLWISH="/home/a/arisvoin/edickie/quarantine//FSL/5.0.9/build/bin/fslwish"
    export HCPPIPEDIR_Bin="/home/a/arisvoin/edickie/quarantine//hcp-pipelines/3.13.1/build//global/binaries"
    export SCINET_MPI_BASE="/scinet/gpc/mpi/openmpi/1.4.4-intel-v12.1"
    export MINC_BIN_DIR="/scratch/project/t/tpaus/tpaus/FREESURFER/freesurfer/mni/bin"
    export SCINET_MPI_INC="/scinet/gpc/mpi/openmpi/1.4.4-intel-v12.1/include"
    export FSFAST_HOME="/scratch/project/t/tpaus/tpaus/FREESURFER/freesurfer/fsfast"
    export PROJECT="/project/a/arisvoin/edickie"
    export SCINET_USE_LMOD="false"
    export MINC_LIB_DIR="/scratch/project/t/tpaus/tpaus/FREESURFER/freesurfer/mni/lib"
    export edickie_QUARANTINE_PATH="/home/a/arisvoin/edickie/quarantine/"
    export HCPPIPEDIR="/home/a/arisvoin/edickie/quarantine//hcp-pipelines/3.13.1/build/"
    export HCPPIPEDIR_tfMRI="/home/a/arisvoin/edickie/quarantine//hcp-pipelines/3.13.1/build//tfMRI/scripts"
    export GDBSERVER_MIC="/scinet/gpc/intel/ics/composer_xe_2013_sp1.1.106/debugger/gdb/target/mic/bin/gdbserver"
    export SCRATCH="/scratch/a/arisvoin/edickie"
    export OLDPWD="/scratch/a/arisvoin/edickie/ABIDE/epi-fixtrain/Yale"
    export LOADEDMODULES="extras/64_6.4:Xlibraries/X11-64:ImageMagick/6.6.7:nano/2.2.4:intel/14.0.1:openmpi/1.4.4-intel-v12.1:gnu-parallel/20140622:edickie_quarantine:FSL/5.0.9:AFNI/2015.12.15:FIX/1.06:connectome-workbench/1.1.1:hcp-pipelines/3.13.1:python/2.7.11-Anaconda2-2.5.0"
    export HISTCONTROL="ignoredups"
    export SCINET_LOGIN="0"
    # -- end copied env
    
    ARRAY_IND=PBS_ARRAYID
    CHUNK_SIZE=4
    CORES=8
    sed -n "$(( (${ARRAY_IND} - 1) * ${CHUNK_SIZE} + 1 )),+$(( ${CHUNK_SIZE} - 1 ))p" << EOF | parallel -j${CORES}
    /scratch/a/arisvoin/edickie/ABIDE/epi-fixtrain/Caltech/Caltech_51456/cmd_160319_104903_20160319.sh
    /scratch/a/arisvoin/edickie/ABIDE/epi-fixtrain/Caltech/Caltech_51458/cmd_160319_104903_20160319.sh
    /scratch/a/arisvoin/edickie/ABIDE/epi-fixtrain/Caltech/Caltech_51461/cmd_160319_104903_20160319.sh
    /scratch/a/arisvoin/edickie/ABIDE/epi-fixtrain/Caltech/Caltech_51462/cmd_160319_104903_20160319.sh
    /scratch/a/arisvoin/edickie/ABIDE/epi-fixtrain/Caltech/Caltech_51463/cmd_160319_104903_20160319.sh
    /scratch/a/arisvoin/edickie/ABIDE/epi-fixtrain/Caltech/Caltech_51466/cmd_160319_104903_20160319.sh
    /scratch/a/arisvoin/edickie/ABIDE/epi-fixtrain/Caltech/Caltech_51470/cmd_160319_104903_20160319.sh
    /scratch/a/arisvoin/edickie/ABIDE/epi-fixtrain/Caltech/Caltech_51471/cmd_160319_104903_20160319.sh
    /scratch/a/arisvoin/edickie/ABIDE/epi-fixtrain/Caltech/Caltech_51472/cmd_160319_104903_20160319.sh
    /scratch/a/arisvoin/edickie/ABIDE/epi-fixtrain/Caltech/Caltech_51475/cmd_160319_104903_20160319.sh
    /scratch/a/arisvoin/edickie/ABIDE/epi-fixtrain/Caltech/Caltech_51476/cmd_160319_104903_20160319.sh
    /scratch/a/arisvoin/edickie/ABIDE/epi-fixtrain/Caltech/Caltech_51477/cmd_160319_104903_20160319.sh
    /scratch/a/arisvoin/edickie/ABIDE/epi-fixtrain/Caltech/Caltech_51478/cmd_160319_104903_20160319.sh
    /scratch/a/arisvoin/edickie/ABIDE/epi-fixtrain/Caltech/Caltech_51479/cmd_160319_104903_20160319.sh
    /scratch/a/arisvoin/edickie/ABIDE/epi-fixtrain/Caltech/Caltech_51480/cmd_160319_104903_20160319.sh
    /scratch/a/arisvoin/edickie/ABIDE/epi-fixtrain/Caltech/Caltech_51481/cmd_160319_104903_20160319.sh
    /scratch/a/arisvoin/edickie/ABIDE/epi-fixtrain/Caltech/Caltech_51482/cmd_160319_104903_20160319.sh
    /scratch/a/arisvoin/edickie/ABIDE/epi-fixtrain/Caltech/Caltech_51483/cmd_160319_104903_20160319.sh
    /scratch/a/arisvoin/edickie/ABIDE/epi-fixtrain/Caltech/Caltech_51484/cmd_160319_104903_20160319.sh
    /scratch/a/arisvoin/edickie/ABIDE/epi-fixtrain/Caltech/Caltech_51485/cmd_160319_104903_20160319.sh
    /scratch/a/arisvoin/edickie/ABIDE/epi-fixtrain/Caltech/Caltech_51487/cmd_160319_104903_20160319.sh
    /scratch/a/arisvoin/edickie/ABIDE/epi-fixtrain/Caltech/Caltech_51489/cmd_160319_104903_20160319.sh
    /scratch/a/arisvoin/edickie/ABIDE/epi-fixtrain/Caltech/Caltech_51491/cmd_160319_104903_20160319.sh
    /scratch/a/arisvoin/edickie/ABIDE/epi-fixtrain/Caltech/Caltech_51492/cmd_160319_104903_20160319.sh
    /scratch/a/arisvoin/edickie/ABIDE/epi-fixtrain/Caltech/Caltech_51493/cmd_160319_104903_20160319.sh
    
    opened by edickie 18
  • Ability to submit a single command like sge_batch

    Ability to submit a single command like sge_batch

    sge_batch has the handy feature of being able to stick a call to it in front of a command line and that command gets submitted to the queue, like so:

    sge_batch echo "hello world" 
    

    Should qbatch have this feature so that it can be a drop-in replacement?

    It will likely be annoying to make argparse handle this case, but I can think of a few other ways to achieve this same feature:

    1. Pipe the command to qbatch, e.g. echo 'echo "hello world"' | qbatch -. It works, but it's unwieldy.
    2. Create a wrapper script that calls qbatch as above. We may have to be a little clever if we also want users to be able to pass arguments to qbatch.
    question 
    opened by pipitone 15
  • 1.0 release

    1.0 release

    i've tagged v1.0rc1 and pushed to pypi. Give it a go and we can work out any blockers in this version and aim to release 1.0 at the end of the week.

    btw, I'm pushing a proper release because I have projects I want to integrate this with.

    opened by pipitone 13
  • Slurm cleanup

    Slurm cleanup

    With access to Niagara and a careful reading of sbatch documentation, the slurm implementation does not conform to how the SGE and PBS configurations work.

    Fixing this up.

    opened by gdevenyi 11
  • Some cosmetic changes to the UI

    Some cosmetic changes to the UI

    Some feedback from a potential user about the UI:

    • [x] Move --ppn and --mem from the advanced section to the general section since they are likely to be used often.
    • [x] Move --workdir and --logdir to advanced section, because they are unlikely to be used often.
    • [x] Create long options for -c as --chunksize and -j as --jobs (or, because that's confusing with our terminology --cores).
    • [x] Set the default for -j to be 100% and --ppn to be 1 rather than arbitrary settings
    • [x] Change --afterok_pattern to just --afterok to simplify
    • [x] Change -w/--workdir to -d/--workdir to be consistent with qsub, and so that we can...
    • [x] Change -t/--walltime to -w/--waltime to more memorable (and because accidentally setting -w 4:00:00 doesn't complain, it just creates a folder called 4:00:00 which is disorientating)
    • [x] Print more detailed usage when the command is run without arguments

    @gdevenyi, any opinions?

    opened by pipitone 11
  • Generate and run local jobfile using parallel, includes logging

    Generate and run local jobfile using parallel, includes logging

    My first try at a local executor.

    Idea here is to allow cluster integrated codes (a la magetbrain) to run locally on a system with a minimal amount of modification. Added logging in for fun.

    Dependencies in this system are obviously handled by the fact that the calling pipeline will probably call in the same order as the dependency generation.

    Thoughts?

    opened by gdevenyi 11
  • --block option to block until jobs have finished

    --block option to block until jobs have finished

    Grid engine has the -sync y option that makes qsub block until the submitted job finishes (or errors out). This can be useful when writing dynamic pipelines with stages that can't be submitted all at once with dependencies (because which later stages run depend on the outputs from earlier stages).

    It appears PBS does not have this feature (and unsure about other platforms), but we could make our own by polling qstat.

    opened by pipitone 10
  • Check for nonsense numerical options?

    Check for nonsense numerical options?

    Should we check for nonsense or incompatible chunk, ppn, and processes?

    Should we allow negative numbers to set no limit?

    Or should we allow users to do dumb things and let qsub complain?

    opened by gdevenyi 10
  • Provide variable QBATCH_THREADS_PER_COMMAND to running jobs

    Provide variable QBATCH_THREADS_PER_COMMAND to running jobs

    Multi-threaded code needs some way to run with many threads.

    Need to understand interaction between arrays and parallel environments in SGE to get this right.

    opened by gdevenyi 10
  • Issue: Handling killing properly with parallel's stdout buffering

    Issue: Handling killing properly with parallel's stdout buffering

    On PBS, it seems to be polite and let parallel dump its buffered STDOUT if the job is killed.

    In comparison, if the job fails (due to memory or walltime) then SGE isn't polite enough to let parallel print out its buffer, so we get no job output.

    parallel has several options to disable or provide progressive buffering, we should investigate which is appropriate.

    opened by gdevenyi 8
  • Print out settings when run

    Print out settings when run

    I wonder if it might be helpful to have a tiny display of the actual settings used (just in case users don't realize what the defaults are, etc), e.g.

    $ qbatch -w 1:00:00 commands.txt
    Processors requested per job (--ppj): 8
          Processes run in parallel (-j): 1
                   Commands per job (-c): 8
                           Walltime (-w): 1:00:00 
                           Other options: none
    

    Thoughts?

    opened by pipitone 8
  • Make --system local a bit more usable

    Make --system local a bit more usable

    --system local is likely to be used semi-interactively on the command line.

    We should adjust the parallel call to be less chatty output wise, and maybe enable the progress bar --bar to give useful feedback.

    opened by gdevenyi 0
  • Handle walltime units uniformly.

    Handle walltime units uniformly.

    SLURM decided to be brain-dead and default to using minutes for unformatted numerical --time option, instead of seconds, like SGE/PBS/Torque.

    This means we need to be explicit about the supported input formats for walltime.

    Torque says: http://docs.adaptivecomputing.com/torque/3-0-5/2.1jobsubmission.php

    walltime	seconds, or [[HH:]MM:]SS	Maximum amount of real time during which the job can be in the running state.
    

    SGE says: https://linux.die.net/man/1/sge_types

    time_specifier
    
    A time specifier either consists of a positive decimal, hexadecimal or octal integer constant, in which case the value is interpreted to be in seconds, or is built by 3 decimal integer numbers separated by colon signs where the first number counts the hours, the second the minutes and the third the seconds. If a number would be zero it can be left out but the separating colon must remain (e.g. 1:0:1 = 1::1 means 1 hours and 1 second).
    

    SLURM says: https://slurm.schedmd.com/sbatch.html

    -t, --time=<time>
    Set a limit on the total run time of the job allocation. If the requested time limit exceeds the partition's time limit, the job will be left in a PENDING state (possibly indefinitely). The default time limit is the partition's default time limit. When the time limit is reached, each task in each job step is sent SIGTERM followed by SIGKILL. The interval between signals is specified by the Slurm configuration parameter KillWait. The OverTimeLimit configuration parameter may permit the job to run longer than scheduled. Time resolution is one minute and second values are rounded up to the next minute.
    A time limit of zero requests that no time limit be imposed. Acceptable time formats include "minutes", "minutes:seconds", "hours:minutes:seconds", "days-hours", "days-hours:minutes" and "days-hours:minutes:seconds".
    
    opened by gdevenyi 1
  • Rename THREADS_PER_COMMAND to QBATCH_THREADS_PER_COMMAND and also export OMP_NUM_THREADS

    Rename THREADS_PER_COMMAND to QBATCH_THREADS_PER_COMMAND and also export OMP_NUM_THREADS

    We should use the QBATCH prefix everywhere.

    Also it seems nproc will honour OMP_NUM_THREADS which means that many apps which rely on openmp will use proper number of threads even if script writers didn't do anything with QBATCH_THREADS_PER_COMMAND

    opened by gdevenyi 2
  • Adjust THREADS_PER_COMMAND for underpacked jobs

    Adjust THREADS_PER_COMMAND for underpacked jobs

    Problem arises like this QBATCH_CHUNKSIZE=40 QBATCH_PPJ=80 QBATCH_CORES=40

    This results in THREADS_PER_COMMAND=2 regardless of the actual length of joblist.

    Instead, this should be adjusted for the length of the joblist if < chunksize

    opened by gdevenyi 0
Releases(v2.3)
Owner
Jon Pipitone
Jon Pipitone
The Pythone Script will generate a (.)sh file with reverse shell codes then you can execute the script on the target

Pythone Script will generate a (.)sh file with reverse shell codes then you can execute the script on the targetPythone Script will generate a (.)sh file with reverse shell codes then you can execute the script on the target

Boy From Future 15 Sep 16, 2022
Kubernetes shell: An integrated shell for working with the Kubernetes

kube-shell Kube-shell: An integrated shell for working with the Kubernetes CLI Under the hood kube-shell still calls kubectl. Kube-shell aims to provi

CloudNative Labs 2.2k Jan 8, 2023
(BionicLambda Universal SHell) A simple shell made in Python. Docs and possible C port incoming.

blush ?? (BionicLambda Universal SHell) A simple shell made in Python. Docs and possible C port incoming. Note: The Linux executables were made on Ubu

null 3 Jun 30, 2021
ICMP Reverse Shell written in Python 3 and with Scapy (backdoor/rev shell)

icmpdoor - ICMP Reverse Shell icmpdoor is an ICMP rev shell written in Python3 and scapy. Tested on Ubuntu 20.04, Debian 10 (Kali Linux), and Windows

Jeroen van Kessel 206 Dec 29, 2022
iTerm2 Shell integration for Xonsh shell.

iTerm2 Shell Integration iTerm2 Shell integration for Xonsh shell. Installation To install use pip: xpip install xontrib-iterm2 # or: xpip install -U

Noorhteen Raja NJ 6 Dec 29, 2022
A simple python script to execute a command when a YubiKey is disconnected

YubiKeyExecute A python script to execute a command when a YubiKey / YubiKeys are disconnected. ‏‏‎ ‎ How to use: 1. Download the latest release and d

null 6 Mar 12, 2022
Automaton - python script to execute bash command based on changes in size of a file.

automaton python script to execute given command <= everytime size of a given file changes,hence everytime a file is modified.(almost) download automa

asrar bhat 1 Jan 3, 2022
xonsh is a Python-powered, cross-platform, Unix-gazing shell language and command prompt.

xonsh xonsh is a Python-powered, cross-platform, Unix-gazing shell language and command prompt. The language is a superset of Python 3.6+ with additio

xonsh 6.7k Jan 8, 2023
CLabel is a terminal-based cluster labeling tool that allows you to explore text data interactively and label clusters based on reviewing that data.

CLabel is a terminal-based cluster labeling tool that allows you to explore text data interactively and label clusters based on reviewing that

Peter Baumgartner 29 Aug 9, 2022
Lets you view, edit and execute Jupyter Notebooks in the terminal.

Lets you view, edit and execute Jupyter Notebooks in the terminal.

David Brochart 684 Dec 28, 2022
AWS Interactive CLI - Allows you to execute a complex AWS commands by chaining one or more other AWS CLI dependency

AWS Interactive CLI - Allows you to execute a complex AWS commands by chaining one or more other AWS CLI dependency

Rafael Torres 2 Dec 10, 2021
Shellcode runner to execute malicious payload and bypass AV

buffshark-shellcode-runner Python Shellcode Runner to execute malicious payload and bypass AV This script utilizes mmap(for linux) and win api wrapper

Momo Lenard 9 Dec 29, 2022
Python command line tool and python engine to label table fields and fields in data files.

Python command line tool and python engine to label table fields and fields in data files. It could help to find meaningful data in your tables and data files or to find Personal identifable information (PII).

APICrafter 22 Dec 5, 2022
Doing set operations on files considered as sets of lines

CLI tool that can be used to do set operations like union on files considering them as a set of lines. Notes It ignores all empty lines with whitespac

Partho 11 Sep 6, 2022
A cd command that learns - easily navigate directories from the command line

NAME autojump - a faster way to navigate your filesystem DESCRIPTION autojump is a faster way to navigate your filesystem. It works by maintaining a d

William Ting 14.5k Jan 3, 2023
A command-line based, minimal torrent streaming client made using Python and Webtorrent-cli. Stream your favorite shows straight from the command line.

A command-line based, minimal torrent streaming client made using Python and Webtorrent-cli. Installation pip install -r requirements.txt It use

Jonardon Hazarika 17 Dec 11, 2022
commandpack - A package of modules for working with commands, command packages, files with command packages.

commandpack Help the project financially: Donate: https://smartlegion.github.io/donate/ Yandex Money: https://yoomoney.ru/to/4100115206129186 PayPal:

null 4 Sep 4, 2021
AML Command Transfer. A lightweight tool to transfer any command line to Azure Machine Learning Services

AML Command Transfer (ACT) ACT is a lightweight tool to transfer any command from the local machine to AML or ITP, both of which are Azure Machine Lea

Microsoft 11 Aug 10, 2022