Skip to content
Snippets Groups Projects

[Webservice] Restructure database to give more meaningful success/failure information

Merged Thomas Kluyver requested to merge webservice-refactor-db into master
1 file
+ 4
4
Compare changes
  • Side-by-side
  • Inline
@@ -231,7 +231,7 @@ class RequestHandler(BaseHTTPRequestHandler):
detector, instrument, in_folder, out_folder, report_to, runs = \
self.parse_calibrate_command(command)
except Exception as e:
print("Failed parsing xfel-calibrate command", e)
print("Failed parsing xfel-calibrate command", e, flush=True)
continue
key = detector if instrument in detector else f"{instrument}-{detector}" # noqa
@@ -283,7 +283,7 @@ class RequestHandler(BaseHTTPRequestHandler):
detector, instrument, in_folder, out_folder, report_to, runs = \
self.parse_calibrate_command(command)
except Exception as e:
print("Failed parsing xfel-calibrate command", e)
print("Failed parsing xfel-calibrate command", e, flush=True)
continue
inst_records = last_calib.setdefault(instrument, [])
@@ -309,11 +309,11 @@ def run(config_file: Optional[str] = None):
with open(config["web-service"]["cal-config"], "r") as cf:
global cal_config
cal_config = yaml.load(cf.read(), Loader=yaml.FullLoader)
print('starting server...')
print('starting server...', flush=True)
sconfig = config["server-config"]
server_address = (sconfig["host"], sconfig["port"])
httpd = HTTPServer(server_address, RequestHandler)
print('running server...')
print('running server...', flush=True)
httpd.serve_forever()
Loading