Skip to content
Snippets Groups Projects
Commit b9504c02 authored by Izzard, Robert Dr (Maths & Physics)'s avatar Izzard, Robert Dr (Maths & Physics)
Browse files

automatically find date, which, bash, env etc. using shutil.which()

parent 0e65a1dd
No related branches found
No related tags found
No related merge requests found
......@@ -216,7 +216,7 @@ class condor():
# build the grid command
grid_command = [
os.path.join("/usr","bin","env"),
str(self.grid_options['condor_env']),
sys.executable,
pyscriptpath,
] + sys.argv[1:] + [
......
......@@ -15,6 +15,7 @@ All the options starting with _ should not be changed by the user except when yo
import datetime
import os
import shutil
import sys
from binarycpython.utils.custom_logging_functions import temp_dir
......@@ -207,9 +208,10 @@ class grid_options_defaults():
"slurm_extra_settings": {}, # Dictionary of extra settings for Slurm to put in its launch script.
"slurm_sbatch": "sbatch", # sbatch command
"slurm_restart_dir" : None, # restart Slurm jobs from this directory
"slurm_bash" : "/bin/bash", # bash location for Slurm
"slurm_pwd" : "/usr/bin/pwd", # pwd command location for Slurm
"slurm_date" : "/usr/bin/date", # bash location for Slurm
"slurm_env" : shutil.which("env"), # env location for Slurm
"slurm_bash" : shutil.which("bash"), # bash location for Slurm
"slurm_pwd" : shutil.which("pwd"), # pwd command location for Slurm
"slurm_date" : shutil.which("date"), # bash location for Slurm
########################################
# Condor stuff
......@@ -239,10 +241,10 @@ class grid_options_defaults():
'condor_save_joined_file':0, # if 1 then results/joined contains the results
# (useful for debugging, otherwise a lot of work)
'condor_requirements':'', # job requirements
'condor_usr_bin_env' : '/usr/bin/env', # /usr/bin/env location
'condor_bash' : '/bin/bash', # bash executable location
"condor_pwd" : "/usr/bin/pwd", # pwd command location for Condor
"condor_date" : "/usr/bin/date", # bash location for Condor
'condor_usr_bin_env' : shutil.which("env"), # /usr/bin/env location
'condor_bash' : shutil.which("bash"), # bash executable location
"condor_pwd" : shutil.which("pwd"), # pwd command location for Condor
"condor_date" : shutil.which("date"), # bash location for Condor
"condor_array_max_jobs" : None, # override for the max number of concurrent array jobs
"condor_initial_dir" : None, # directory from which condor is run, if None is the directory in which your script is run
"condor_submit" : "condor_submit", # the condor_submit command
......
......@@ -175,19 +175,19 @@ class slurm():
# run a grid of stars only, leaving the results
# in the appropriate outfile
return False
elif self.grid_options['slurm'] == 3:
# joining : set the evolution type to "join" and return
# False to continue
self.grid_options['evolution_type'] = 'join'
return False
elif self.grid_options['slurm'] == 1:
# if slurm=1, we should have no evolution type, we
# set up the Slurm scripts and get them evolving
# in a Slurm array
self.grid_options['evolution_type'] = None
# make dirs
self.make_slurm_dirs()
......@@ -219,7 +219,7 @@ class slurm():
# build the grid command
grid_command = [
os.path.join("/usr","bin","env"),
str(grid_options['slurm_env'])
sys.executable,
str(lib_programname.get_path_executed_script()),
] + sys.argv[1:] + [
......@@ -351,4 +351,3 @@ echo {slurm_dir}/results/$SLURM_ARRAY_JOB_ID.$SLURM_ARRAY_TASK_ID.gz >> {slurm_d
# return True so we exit immediately
return True
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment