aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2022-05-31 14:39:31 +0300
committerFrederick Muriuki Muriithi2022-05-31 14:41:45 +0300
commit45f7328e733fa655e7871d3c841c2dc778915d36 (patch)
tree7bad0ca4a616f9cd57bfae8b2271c813bd489ea1
parent9da7d8bb16497b98c08c1da061c1bb14335c9fca (diff)
downloadgenenetwork2-45f7328e733fa655e7871d3c841c2dc778915d36.tar.gz
Fix error rendering
Render the command_id if present in the error report to help with troubleshooting failures.
-rw-r--r--wqflask/wqflask/partial_correlations_views.py17
-rw-r--r--wqflask/wqflask/templates/partial_correlations/pcorrs_error.html8
2 files changed, 21 insertions, 4 deletions
diff --git a/wqflask/wqflask/partial_correlations_views.py b/wqflask/wqflask/partial_correlations_views.py
index 7456ae2e..ce5e46e0 100644
--- a/wqflask/wqflask/partial_correlations_views.py
+++ b/wqflask/wqflask/partial_correlations_views.py
@@ -224,10 +224,11 @@ def response_error_message(response):
response.status_code,
"General API server error!!")
-def render_error(error_message):
+def render_error(error_message, command_id = None):
return render_template(
"partial_correlations/pcorrs_error.html",
- message = error_message)
+ message = error_message,
+ command_id = command_id)
def __format_number(num):
if num is None or math.isnan(num):
@@ -346,10 +347,18 @@ def process_pcorrs_command_output(result):
def poll_partial_correlation_results(command_id):
response = requests.get(
url=f"{GN_SERVER_URL}api/async_commands/state/{command_id}")
+
if response.status_code == 200:
data = response.json()
- if data["status"] == "error":
- return render_error(response["result"])
+ raw_result = data["result"]
+ result = {"status": "computing"}
+ if raw_result:
+ result = json.loads(raw_result)
+ if result["status"].lower() in ("error", "exception"):
+ return render_error(
+ "We messed up, and the computation failed due to a system "
+ "error.",
+ command_id)
if data["status"] == "success":
return process_pcorrs_command_output(json.loads(data["result"]))
return render_template(
diff --git a/wqflask/wqflask/templates/partial_correlations/pcorrs_error.html b/wqflask/wqflask/templates/partial_correlations/pcorrs_error.html
index 91f6baf2..8d6c4bbe 100644
--- a/wqflask/wqflask/templates/partial_correlations/pcorrs_error.html
+++ b/wqflask/wqflask/templates/partial_correlations/pcorrs_error.html
@@ -36,6 +36,14 @@
{{message}}
</p>
+ {%if command_id %}
+ <p>
+ Please provide the following information to help with
+ troubleshooting:<br />
+ <strong>Command ID</strong>: <em>{{command_id}}</em>
+ </p>
+ {%endif%}
+
<p>
To check if this already a known issue, search the
<a href="https://github.com/genenetwork/genenetwork2/issues">issue