201 return |
201 return |
202 |
202 |
203 if monitor: |
203 if monitor: |
204 self.monitor_processing(measurement_id) |
204 self.monitor_processing(measurement_id) |
205 |
205 |
206 def process(self, filename, system_id): |
206 def process(self, filename, system_id, rs_filename=None): |
207 """ Upload a file for processing and wait for the processing to finish. |
207 """ Upload a file for processing and wait for the processing to finish. |
208 If the processing is successful, it will download all produced files. |
208 If the processing is successful, it will download all produced files. |
209 """ |
209 """ |
210 logger.info("--- Processing started on %s. ---" % datetime.datetime.now()) |
210 logger.info("--- Processing started on %s. ---" % datetime.datetime.now()) |
211 # Upload file |
211 # Upload file |
212 measurement_id = self.upload_file(filename, system_id) |
212 measurement_id = self.upload_file(filename, system_id, rs_filename=rs_filename) |
213 |
213 |
214 measurement = self.monitor_processing(measurement_id) |
214 measurement = self.monitor_processing(measurement_id) |
215 return measurement |
215 return measurement |
216 |
216 |
217 def monitor_processing(self, measurement_id): |
217 def monitor_processing(self, measurement_id): |
427 measurement_id = scc.upload_file(filename, system_id, rs_filename=rs_filename) |
427 measurement_id = scc.upload_file(filename, system_id, rs_filename=rs_filename) |
428 scc.logout() |
428 scc.logout() |
429 return measurement_id |
429 return measurement_id |
430 |
430 |
431 |
431 |
432 def process_file(filename, system_id, settings): |
432 def process_file(filename, system_id, settings, rs_filename=None): |
433 """ Shortcut function to process a file to the SCC. """ |
433 """ Shortcut function to process a file to the SCC. """ |
434 logger.info("Processing file %s, using sytem %s" % (filename, system_id)) |
434 logger.info("Processing file %s, using sytem %s" % (filename, system_id)) |
435 |
435 |
436 scc = SCC(settings['basic_credentials'], settings['output_dir'], settings['base_url']) |
436 scc = SCC(settings['basic_credentials'], settings['output_dir'], settings['base_url']) |
437 scc.login(settings['website_credentials']) |
437 scc.login(settings['website_credentials']) |
438 measurement = scc.process(filename, system_id) |
438 measurement = scc.process(filename, system_id, rs_filename=rs_filename) |
439 scc.logout() |
439 scc.logout() |
440 return measurement |
440 return measurement |
441 |
441 |
442 |
442 |
443 def delete_measurement(measurement_id, settings): |
443 def delete_measurement(measurement_id, settings): |