-
Notifications
You must be signed in to change notification settings - Fork 1
/
run_Slurm.py
executable file
·35 lines (31 loc) · 976 Bytes
/
run_Slurm.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# Standard package
import imp,sys,os,time
from SLURMWorker.SLURMWorker import SLURMWorker
from Core.mkdir_p import mkdir_p
cfgFileName = sys.argv[1]
cfgAbsFilePath = os.path.abspath(cfgFileName)
file = open( cfgFileName,'r')
cfg = imp.load_source( 'UFNTuple.__cfg_to_run__', cfgFileName, file)
commands = """
cd {base_path}
source setup_hpg.sh
UFNTuple {cfg_path}
""".format(
base_path=os.environ["BASE_PATH"],
cfg_path=cfgAbsFilePath,
)
script_file_name = os.path.join(cfg.outputInfo.outputDir,cfg.slurm_job_name+".cfg")
mkdir_p(cfg.outputInfo.outputDir)
worker = SLURMWorker()
worker.make_sbatch_script(
script_file_name,
cfg.slurm_job_name,
cfg.slurm_email,
cfg.slurm_ntasks,
cfg.slurm_mem,
cfg.slurm_time,
cfg.outputInfo.outputDir,
commands,
n_core = cfg.nCores,
)
worker.sbatch_submit(script_file_name)