for example, need to change all of these:
output = subprocess.check_output("scontrol show hostnames \"$SLURM_NODELIST\" | tr '\n' ','", shell=True)
to these:
subprocess.check_output(["scontrol","show","hostnames",os.environ["SLURM_NODELIST"]]).replace("\n"," ")[:-1]
In this specific case, the quotes around $SLURM_NODELIST appear to condition adequately, but I think in general it is unsafe to use "shell=True" when unncessary.
for example, need to change all of these:
output = subprocess.check_output("scontrol show hostnames \"$SLURM_NODELIST\" | tr '\n' ','", shell=True)
to these:subprocess.check_output(["scontrol","show","hostnames",os.environ["SLURM_NODELIST"]]).replace("\n"," ")[:-1]
In this specific case, the quotes around $SLURM_NODELIST appear to condition adequately, but I think in general it is unsafe to use "shell=True" when unncessary.