-1

I need to run a different script depending on the type of scheduler, which necessitates a reliable way to detect if the scheduler is Torque, SGE or something else. Something like $SHELL telling which shell I am using. or something like name.

I am aware of environmental variables the two systems set, but they don't offer me a reliable or an elegant way - given the commands the env. variables are named similarly or identically.. there needs to several ifs and buts before we can conclude which is it.

  • Each of these exports a set of environment variables. Look for those to see what scheduler was used to launch your job. Or just read the documentation of your system. – Jeff Hammond Dec 24 '15 at 03:59
  • well, I am aware of those, they don't offer me a **reliable** or an elegant way - given the commands the env. variables are named similarly or identically.. there needs to several ifs and buts before we can conclude which is it. – Pradeep Reddy Raamana Dec 24 '15 at 07:39

1 Answers1

1

Set an environment variable explicitly in your .bashrc that you can later query.

e.g.

export RUNNING_ON="moms_gpu_cluster5"
export THIS_SYSTEMS_SCHEDULER="SGE" 

You won't have to rely on what the sysadmin gives you, or what the scheduler does or doesn't do.

Adam Michalik
  • 9,678
  • 13
  • 71
  • 102