-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrdahmm_model_debug.py
executable file
·39 lines (34 loc) · 1.25 KB
/
rdahmm_model_debug.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
#!/usr/local/bin/python
#==========================================================================
# Execute rdahmm modeling for all ingested scripps datasets.
# Use subprocess to invoke multiple rdahmm_model_single.py for
# parallel processing
#
# usage: rdahmm_model.py
#
#===========================================================================
import os, glob, subprocess, sys
from threading import Thread
from properties import properties
data_path = properties('data_path')
model_cmd = properties('script_path') + "/rdahmm_model_single_debug.py"
class ThreadJob(Thread):
def __init__(self, dataset):
Thread.__init__(self)
self.dataset = dataset
def run(self):
cmd = model_cmd
# start = time.time()
print "+++Starting process ", dataset, " ..."
p = subprocess.Popen([cmd, self.dataset], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
(stdout, stderr) = p.communicate()
# end = time.time()
if p.returncode != 0:
print p.stderr
print "+++Finished process ", dataset
for dataset in os.listdir(data_path):
if "Strain" in dataset or "UNAVCO" in dataset or "raw" in dataset:
continue
# print dataset
t = ThreadJob(dataset)
t.start()