Clinical-Genomics / scout

VCF visualization interface
https://clinical-genomics.github.io/scout
BSD 3-Clause "New" or "Revised" License
152 stars 46 forks source link

refactor app logging #4857

Closed northwestwitch closed 2 months ago

northwestwitch commented 2 months ago

This PR adds a functionality or fixes a bug.

Testing on cg-vm1 server (Clinical Genomics Stockholm) **Prepare for testing** 1. Make sure the PR is pushed and available on [Docker Hub](https://hub.docker.com/repository/docker/clinicalgenomics/scout-server-stage) 1. Fist book your testing time using the Pax software available at [https://pax.scilifelab.se/](https://pax.scilifelab.se). The resource you are going to call dibs on is `scout-stage` and the server is `cg-vm1`. 1. `ssh @cg-vm1.scilifelab.se` 1. `sudo -iu hiseq.clinical` 1. `ssh localhost` 1. (optional) Find out which scout branch is currently deployed on cg-vm1: `podman ps` 1. Stop the service with current deployed branch: `systemctl --user stop scout.target` 1. Start the scout service with the branch to test: `systemctl --user start scout@` 1. Make sure the branch is deployed: `systemctl --user status scout.target` 1. After testing is done, repeat procedure at [https://pax.scilifelab.se/](https://pax.scilifelab.se), which will release the allocated resource (`scout-stage`) to be used for testing by other users.
Testing on hasta server (Clinical Genomics Stockholm) **Prepare for testing** 1. `ssh @hasta.scilifelab.se` 1. Book your testing time using the Pax software. `us; paxa -u -s hasta -r scout-stage`. You can also use the WSGI Pax app available at [https://pax.scilifelab.se/](https://pax.scilifelab.se). 1. (optional) Find out which scout branch is currently deployed on cg-vm1: `conda activate S_scout; pip freeze | grep scout-browser` 1. Deploy the branch to test: `bash /home/proj/production/servers/resources/hasta.scilifelab.se/update-tool-stage.sh -e S_scout -t scout -b ` 1. Make sure the branch is deployed: `us; scout --version` 1. After testing is done, repeat the `paxa` procedure, which will release the allocated resource (`scout-stage`) to be used for testing by other users.

How to test:

  1. Deploy this branch on stage https://github.com/Clinical-Genomics/servers/pull/1448/files
  2. Deploy on stage
  3. Check the logs created under /tmp/tmp_scout_users_activity.log
  4. Check also the logs of the container: podman logs

Expected outcome: The functionality should be working Take a screenshot and attach or copy/paste the output.

Review:

codecov[bot] commented 2 months ago

Codecov Report

Attention: Patch coverage is 66.66667% with 7 lines in your changes missing coverage. Please review.

Project coverage is 84.78%. Comparing base (44aaa30) to head (02d0357). Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
scout/log/log.py 61.11% 7 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #4857 +/- ## ========================================== + Coverage 84.62% 84.78% +0.16% ========================================== Files 319 319 Lines 19315 19289 -26 ========================================== + Hits 16345 16354 +9 + Misses 2970 2935 -35 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

northwestwitch commented 2 months ago

The code of this PR looks quite straightforward to me, but when I try starting the app as a service on stage it starts but then the container fails immediately without printing any code or message that could be of help in the debugging. I'll try to run it as a service locally.. Perhaps I'll understand!

northwestwitch commented 2 months ago

The code of this PR looks quite straightforward to me, but when I try starting the app as a service on stage it starts but then the container fails immediately without printing any code or message that could be of help in the debugging. I'll try to run it as a service locally.. Perhaps I'll understand!

Ah that's annoying: when pulling the branch from docker hub it complains that the image is not built for architecture "arm64", of course!

dnil commented 2 months ago

From the log this morning it looked like it had trouble with the log email. Have you tried locally with email on?

northwestwitch commented 2 months ago

From the log this morning it looked like it had trouble with the log email. Have you tried locally with email on?

How did you check that log, for me it was just "failed with error"

northwestwitch commented 2 months ago

Ah, I can even reproduce locally. Thanks, that was super helpful!

northwestwitch commented 2 months ago

That was definitely it! Now that's I've reintroduced the code to send the emails it works as expected!

It even writes to file in the /tmp/tmp_scout_users_activity.log file! 🥳

Thanks @dnil !!

northwestwitch commented 2 months ago

From the log this morning it looked like it had trouble with the log email. Have you tried locally with email on?

How did you check that log, for me it was just "failed with error"

It was printing errors all along in /tmp/tmp_scout_users_activity.log. I just figured it out! 😆

dnil commented 2 months ago

Thank journalctl and the service going down repeatedly... :)

northwestwitch commented 2 months ago

This seems to work as intended now. Marking it as ready for review!

sonarcloud[bot] commented 2 months ago

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
0.0% Coverage on New Code
0.0% Duplication on New Code

See analysis details on SonarCloud