-
Notifications
You must be signed in to change notification settings - Fork 46
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Flash an alert when loqus instance is not reachable #4673
Conversation
Nice! Just ping when ready for review! |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #4673 +/- ##
=======================================
Coverage 84.49% 84.50%
=======================================
Files 310 310
Lines 18798 18797 -1
=======================================
Hits 15884 15884
+ Misses 2914 2913 -1 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Co-authored-by: Daniel Nilsson <daniel.k.nilsson@gmail.com>
LOG.info(search_resp.get("detail")) | ||
if "details" not in search_resp.get("message", {}): # Connection error | ||
flash( | ||
f"Connection to Loqusdb instance returned error: '{search_resp['message']}'", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
😊 Yeah, {}
will not have "message"..
@@ -78,15 +76,15 @@ def mockapi(*args): | |||
def test_loqus_api_snv_variant_not_found(loqus_api_app, monkeypatch, loqus_api_variant): | |||
# GIVEN a mocked loqus API that doesn't return usable info | |||
def mockapi(*args): | |||
return {"message": {"details": "not found"}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was wrong, because api_get returns a response body with "message" only when there is an exception but variant not found doesn't trigger an exception
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, that is loqusdbapi insert style errors. Maybe there was an intention to change at some point. 😊
Or fails obviously, which we were after elsewhere here.
Quality Gate passedIssues Measures |
return {} | ||
return search_resp.get("content") | ||
|
||
if search_resp.get("status_code") == 200: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can't trigger error any more no?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed, this solves the issue. I think I will make a new one for loqusdbapi to return a bit more elegantly, especially with totals as well even if the variant was not found, and we can revisit the issue. CLI loqusdb does return totals always, if asked to.
obs_data[loqus_id]["observations"] = 0 | ||
|
||
if obs_data[loqus_id] == {}: # Variant was not found | ||
obs_data[loqus_id]["observations"] = 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that should be it. I do think before long we should modify the loqusdbapi return so that we get a total set also for variant not found - after all we do have the variant type, and can tell how many of those cases we have - but that is not for this issue.
@@ -78,15 +76,15 @@ def mockapi(*args): | |||
def test_loqus_api_snv_variant_not_found(loqus_api_app, monkeypatch, loqus_api_variant): | |||
# GIVEN a mocked loqus API that doesn't return usable info | |||
def mockapi(*args): | |||
return {"message": {"details": "not found"}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, that is loqusdbapi insert style errors. Maybe there was an intention to change at some point. 😊
Or fails obviously, which we were after elsewhere here.
This PR adds a functionality or fixes a bug.
Testing on cg-vm1 server (Clinical Genomics Stockholm)
Prepare for testing
scout-stage
and the server iscg-vm1
.ssh <USER.NAME>@cg-vm1.scilifelab.se
sudo -iu hiseq.clinical
ssh localhost
podman ps
systemctl --user stop scout.target
systemctl --user start scout@<this_branch>
systemctl --user status scout.target
scout-stage
) to be used for testing by other users.Testing on hasta server (Clinical Genomics Stockholm)
Prepare for testing
ssh <USER.NAME>@hasta.scilifelab.se
us; paxa -u <user> -s hasta -r scout-stage
. You can also use the WSGI Pax app available at https://pax.scilifelab.se/.conda activate S_scout; pip freeze | grep scout-browser
bash /home/proj/production/servers/resources/hasta.scilifelab.se/update-tool-stage.sh -e S_scout -t scout -b <this_branch>
us; scout --version
paxa
procedure, which will release the allocated resource (scout-stage
) to be used for testing by other users.How to test -- on cg-vm1:
How to test -- locally:
Expected outcome:
Review: