-
Notifications
You must be signed in to change notification settings - Fork 0
/
cron_rdahmm_unavco.py
executable file
·67 lines (59 loc) · 2.58 KB
/
cron_rdahmm_unavco.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 unavco datasets
# Set up a cron job to run nightly
#
# usage: cron_rdahmm_unavco.py
#
#===========================================================================
import os, subprocess, sys
from threading import Thread
from properties import properties
unavco_cmd = properties('script_path') + "/unavco_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 = "UNAVCO_" + dataset.upper()
def run(self):
# ingest a given dataset: pbo | nucleus
print "+++Starting process UNAVCO ", self.source, " ..."
cmd = unavco_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 UNAVCO ", 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 ['pbo', 'nucleus']:
t = ThreadJob(dataset)
t.start()