diff --git a/src/mtl/run_gunicorn.py b/src/mtl/run_gunicorn.py index 067b220..cd9b5cd 100644 --- a/src/mtl/run_gunicorn.py +++ b/src/mtl/run_gunicorn.py @@ -19,6 +19,7 @@ def run_gunicorn(): options = { "bind": "127.0.0.1:15478", "workers": 12, + "accesslog": "/dev/stderr", } StandaloneApplication(app, options).run() diff --git a/src/mtl/run_server.py b/src/mtl/run_server.py index 45ec47d..770a78c 100644 --- a/src/mtl/run_server.py +++ b/src/mtl/run_server.py @@ -16,10 +16,16 @@ def check_property(): res.headers['Access-Control-Allow-Origin'] = '*' res.content_type = "application/json" return res - traces = data.get("traces") - processed_traces = {} - for trace_name, trace in traces.items(): - processed_traces[trace_name] = [(simtime, value) for [simtime, value] in trace] + try: + traces = data.get("traces") + processed_traces = {} + for trace_name, trace in traces.items(): + processed_traces[trace_name] = [(simtime, value) for [simtime, value] in trace] + except Exception as e: + res = make_response(jsonify("property successfully parsed, but error pre-processing trace. likely your request is not in the expected format. error was: " + str(e))) + res.headers['Access-Control-Allow-Origin'] = '*' + res.content_type = "application/json" + return res try: result = phi(processed_traces, time=None, quantitative=False) except Exception as e: