-
Notifications
You must be signed in to change notification settings - Fork 16
/
submitJobs_local.py
executable file
·40 lines (34 loc) · 1.26 KB
/
submitJobs_local.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
36
37
38
39
40
#! /usr/bin/env python
"""
Search and run all pbs files inside direct subdirectories under the given
path.
"""
from sys import argv, exit
from os import path, listdir
# check for existing saved_configs.py file
if path.exists("saved_configs.py"):
# use saved config file
import saved_configs
targetWorkingDirectory = saved_configs.iEbeConfigs["working_folder"]
else:
# use CML arguments
if len(argv)>=2:
targetWorkingDirectory = path.abspath(argv[1])
else:
targetWorkingDirectory = "PlayGround"
# check existence of target working directory
if path.exists(targetWorkingDirectory):
print("Start submitting jobs from %s..." % targetWorkingDirectory)
else:
print("Usage: submitJobs [from_directory=PlayGround]")
exit()
from subprocess import Popen
# submit jobs
for aFolder in listdir(targetWorkingDirectory):
subFolder = path.join(targetWorkingDirectory, aFolder)
for aFile in listdir(subFolder):
if path.splitext(aFile)[1].lower() == '.pbs':
commandString = "bash ./%s" % aFile
print("Running %s in %s..." % (commandString, subFolder))
Popen(commandString, shell=True, cwd=subFolder)
print("Job submission done. See RunRecord.txt file in each job folder for progress.")