Mercurial > repos > george-weingart > micropita
comparison micropita_prepare.py @ 12:6e94c5a60c80
Removed obsolete prints; Set the process using subprocess and using tempfile to alllocate the temporary file
author | george-weingart |
---|---|
date | Tue, 06 May 2014 20:20:26 -0400 |
parents | 1dcb00d567f7 |
children | 627e25eb606d |
comparison
equal
deleted
inserted
replaced
11:1dcb00d567f7 | 12:6e94c5a60c80 |
---|---|
44 import blist | 44 import blist |
45 import shlex | 45 import shlex |
46 import tempfile | 46 import tempfile |
47 | 47 |
48 ################################################################################## | 48 ################################################################################## |
49 # Modification # | 49 # Modification by George Weingart 5/6/2014 # |
50 # Using subprocess # | 50 # Using subprocess to invoke the calls to Micropita # |
51 # and allocating the temporary file using trmpfile # | |
51 ################################################################################## | 52 ################################################################################## |
52 | 53 |
53 | 54 |
54 | 55 |
55 | 56 |
76 pass | 77 pass |
77 try: | 78 try: |
78 parser.add_argument('--label_value', action="store",dest='label_value') | 79 parser.add_argument('--label_value', action="store",dest='label_value') |
79 except: | 80 except: |
80 pass | 81 pass |
81 | |
82 | |
83 | |
84 return parser | 82 return parser |
85 | 83 |
86 | 84 |
87 ################################################################################## | 85 ################################################################################## |
88 # Main Program # | 86 # Main Program # |
149 stratify_string + " " +\ | 147 stratify_string + " " +\ |
150 results.inputname + " " +\ | 148 results.inputname + " " +\ |
151 results.outputname | 149 results.outputname |
152 #print os_command | 150 #print os_command |
153 os.system(os_command) | 151 os.system(os_command) |
154 | 152 argsx = shlex.split(os_command) #Split the command |
155 | 153 try: |
156 ######"/tools/micropita/" + \ 1234 | 154 subprocess.check_call(argsx , shell=False) |
157 | 155 except: |
158 print "Before invoking the call 1234" | 156 print "The call to micropita failed=============" |
159 print root_dir | 157 sys.exit(0) |
158 | |
159 | |
160 | 160 |
161 if results.MParameter == "representative"\ | 161 if results.MParameter == "representative"\ |
162 or results.MParameter == "diverse"\ | 162 or results.MParameter == "diverse"\ |
163 or results.MParameter == "extreme": | 163 or results.MParameter == "extreme": |
164 os_command = "python " + \ | 164 os_command = "python " + \ |
168 "-m " + results.MParameter + " " + \ | 168 "-m " + results.MParameter + " " + \ |
169 "-n " + results.NSamples + " " +\ | 169 "-n " + results.NSamples + " " +\ |
170 stratify_string + " " + \ | 170 stratify_string + " " + \ |
171 results.inputname + " " +\ | 171 results.inputname + " " +\ |
172 results.outputname | 172 results.outputname |
173 ##print os_command | 173 argsx = shlex.split(os_command) #Split the command |
174 argsx = shlex.split(os_command) | |
175 print argsx | |
176 try: | 174 try: |
177 ###os.system(os_command) | 175 ###os.system(os_command) |
178 subprocess.check_call(argsx , shell=False) | 176 subprocess.check_call(argsx , shell=False) |
179 except: | 177 except: |
180 print "The call to micropita failed=============" | 178 print "The call to micropita failed=============" |
194 "-n " + results.NSamples + " " +\ | 192 "-n " + results.NSamples + " " +\ |
195 stratify_string + " " + \ | 193 stratify_string + " " + \ |
196 results.inputname + " " +\ | 194 results.inputname + " " +\ |
197 results.outputname | 195 results.outputname |
198 #print os_command | 196 #print os_command |
199 os.system(os_command) | 197 argsx = shlex.split(os_command) #Split the command |
198 try: | |
199 subprocess.check_call(argsx , shell=False) | |
200 except: | |
201 print "The call to micropita failed=============" | |
202 sys.exit(0) |