This repository was archived by the owner on Jan 24, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathBatchRunner.py
More file actions
executable file
·35 lines (28 loc) · 1.42 KB
/
BatchRunner.py
File metadata and controls
executable file
·35 lines (28 loc) · 1.42 KB
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
#!/usr/bin/env /imaging/analysis/People/imageweb/batchprofiler/cgi-bin/python-2.6.sh
from sys import argv,exit,path
from subprocess import Popen, PIPE, STDOUT
from scipy.io.matlab import loadmat
from os.path import exists
if len(argv) != 6:
print "usage: %s DataDir QueueType BatchSize WriteOutData(yes/no) Timeout"%(argv[0])
exit(1)
datadir = argv[1]
queue = argv[2]
batch_size = int(argv[3])
write_data = argv[4]
timeout = int(argv[5])
CPCluster=path[0]
# Load Batch_data and figure out the sets that need running
batch_info = loadmat("%(datadir)s/Batch_data.mat"%(locals()),struct_as_record=False)
num_sets = batch_info['handles'][0,0].Current[0,0].NumberOfImageSets[0,0]
# Loop over batches, check status file, print out commands for those that need it
for start in range(1, num_sets + 1, batch_size):
end = start + batch_size - 1
if end > num_sets:
end = num_sets
status_file_name = "%(datadir)s/status/Batch_%(start)d_to_%(end)d_DONE.mat"%(locals())
if not exists(status_file_name):
print "bsub -P imaging -q %(queue)s -o %(datadir)s/txt_output/%(start)s_to_%(end)s.txt %(CPCluster)s/CPCluster.py %(datadir)s/Batch_data.mat %(start)s %(end)s %(datadir)s/status Batch_ %(write_data)s %(timeout)d"%(locals())
# for i in `; do
# echo bsub -P imaging -q $QueueType -o ${BatchTxtOutputDir}/${i}.txt $CPCluster/CPCluster.sh ${BatchDataDir}/${BatchPrefix}data.mat $i $BatchStatusDir $BatchPrefix
# done