slurmhpcqsubtorquesbatch

How would you check if SLURM or MOAB/Torque is available on an environment?


The title kind of says it all. I'm looking for a command line test to check if either SLURM, or MOAB/Torque is available for submitting jobs too.

My thought is to check if the command qstat finishes with exit code, or if squeue finished with exit code zero. Would this be the best way of doing this?


Solution

  • One of the most lightweight way to do that is to test for the presence of sbatch for instance, with

    which sbatch
    

    The which command exits with 0 exit code if the command is found in the PATH.

    Make sure to test in order, as, for instance, a Slurm cluster could have a qsub command available to emulate PBS or Torque.