-
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
Fix remaining relative paths on load #4388
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #4388 +/- ##
==========================================
+ Coverage 84.63% 84.66% +0.02%
==========================================
Files 310 310
Lines 18598 18643 +45
==========================================
+ Hits 15741 15784 +43
- Misses 2857 2859 +2 ☔ View full report in Codecov by Sentry. |
In the sense of cursing again? 😆 |
Doubly so! Cursing again because the recursion is cursed again. |
Wouldn't be easier to fix relative paths directly when the case load config is validated with Pydantic? The validator has a function that checks if the path (relative or complete) exists on disk. Ifwe change that function to not only do the validation, but also set the paths to full path then you don't need any extra code I think. The validator itself has this tiny function that does the trick for demo files (at least those for which is required a validation at the moment) |
I wouldn't say easier, but I'm looking through now, and Im starting to agree that it would make sense to try to do it there when we anyway touch those files/variables. As you say, there is already one that is called for some of the demo files, that must just be slightly bugged since we do have tons of relative paths on the demo. I guess my only fundamental issue with that is that it will confound the role of that class, as it changes the returned values compared to what is in the config file as such, before we get around to storing it on db. If we start doing this there, we could start doing all of the |
So, let's merge this perhaps: unless you find something wrong with it, that would really be the easiest. Then we can refactor the functionality of |
I think it just checks that the relative paths are valid, but it doesn't fix it yet. Regarding the pydantic class role: It does the fixing of other fields, for instance converting strings to integers, fixes the path for the str variants images, etc. So why not this? |
Right, right; it checks that the absolute path version of the relative one would be valid.
No, exactly - I agree! That would probably be the most standard use of the Pydantic Class, and is consistent with it being called to parse the case config. But there are more things that |
Quality Gate passedIssues Measures |
This PR adds a functionality or fixes a bug.
Several relative paths can potentially get stored on db on load, relative to the working directory at load time. This is very seldom what is intended: most endpoints that serve files in fact attempt to convert to absoulte paths when used, but if the server app is started in a different directory, this will fail. For CG Solna, this is also rarely a problem since our configs use abs file paths in general. It is however noticeable on demo setups and potentially confusing to new users.
The downside might be it closes a potential workaround for container volume mounting, where the absolute path might not be the same on the CLI as on the web app.
On the total, making the behaviour predictable (absolute paths) is preferable.
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:
Expected outcome:
The functionality should be working
Take a screenshot and attach or copy/paste the output.
Review: