-
Notifications
You must be signed in to change notification settings - Fork 0
/
cron_rdahmm_unr.py
executable file
·67 lines (59 loc) · 2.55 KB
/
cron_rdahmm_unr.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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#!/usr/local/bin/python
#==========================================================================
# Ingest, and execute rdahmm evaluation for UNR datasets
# Set up a cron job to run nightly
#
# usage: cron_rdahmm_unr.py
#
#===========================================================================
import os, subprocess, sys
from threading import Thread
from properties import properties
unr_cmd = properties('script_path') + "/unr_ingest_single.py"
eval_cmd = properties('script_path') + "/rdahmm_eval_single.py"
xml_cmd = properties('script_path') + "/create_summary_xmls.py"
json_cmd = properties('script_path') + "/create_summary_jsons.py"
class ThreadJob(Thread):
def __init__(self, dataset):
Thread.__init__(self)
self.source = dataset
self.dataset = "UNR_" + dataset.upper()
def run(self):
# ingest a given dataset: igs08 | fid
print "+++Starting process UNR ", self.source, " ..."
cmd = unr_cmd
p = subprocess.Popen([cmd, self.source], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
(stdout, stderr) = p.communicate()
if p.returncode != 0:
print p.stderr
print "+++Finished process UNR ", self.source
# run rdahmm evaluation on the corresponding dataset
print "+++Starting process ", self.dataset, " ..."
cmd = eval_cmd
#cmd = "echo"
p = subprocess.Popen([cmd, self.dataset], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
(stdout, stderr) = p.communicate()
if p.returncode != 0:
print p.stderr
print "+++Finished process ", self.dataset
# create summary xml on the corresponding dataset
print "+++creating summary xml for ", self.dataset, " ..."
cmd = xml_cmd
#cmd = "echo"
p = subprocess.Popen([cmd, self.dataset], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
(stdout, stderr) = p.communicate()
if p.returncode != 0:
print p.stderr
print "+++Finished creating summary xml for ", self.dataset
# create summary json on the corresponding dataset
print "+++creating summary json for ", self.dataset, " ..."
cmd = json_cmd
#cmd = "echo"
p = subprocess.Popen([cmd, self.dataset], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
(stdout, stderr) = p.communicate()
if p.returncode != 0:
print p.stderr
print "+++Finished creating summary json for ", self.dataset
for dataset in ['fid', 'igs08']:
t = ThreadJob(dataset)
t.start()