-
Notifications
You must be signed in to change notification settings - Fork 0
/
sup.py
executable file
·30 lines (26 loc) · 951 Bytes
/
sup.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
#!/usr/bin/env python
# submits all *.sh files to cluster, either all scripts in a folder or just a list of files
# usage: ./sup.py -f path/to/scripts [script_pattern]
# or ./sup.py arbitrary number of filesnames
import os
import sys
import datetime
from subprocess import call
pattern=''
path=''
files=[]
if len(sys.argv) > 1 and sys.argv[1]=='-f':
if len(sys.argv) > 2:
path= sys.argv[2]+'/'
if len(sys.argv) > 3:
pattern= sys.argv[3]
files = [os.path.join(root, name)
for root, dirs, files in os.walk('./'+path)
for name in files
if pattern in name and name.endswith((".sh"))]
else:
files=sys.argv[1:]
if not os.path.exists('logs'):
os.makedirs('logs')
for f in files:
call(['qsub', '-cwd', '-S', '/bin/bash','-l', 'h=bird*', '-hard','-l', 'os=sld6', '-l' ,'h_vmem=2000M', '-l', 's_vmem=2000M' ,'-o', 'logs/$JOB_NAME.o$JOB_ID', '-e', 'logs/$JOB_NAME.e$JOB_ID', f])