I want to run a python function,say my_fun(x1,x2)
, on different nodes of cluster with SGE (QSUB). I created a script my_script.py
which takes in the numeric arguments from the command line, so when running locally, I'd call it as
python my_script.py x1 x2
Now I want to submit this script to the cluster in a loop with different values of x1 and x2. Also, for the node to have access to python & the installed modules, I need to run module load Python/2.7
on the node before calling the python script through QSUB.
This seems like a pretty simple and typical use-case, but I can't find any straightforward way to do this from Python. Going back and forth between BASH and Python seems a bit clunky.