-
-
Notifications
You must be signed in to change notification settings - Fork 102
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
QC reports require locking index.html
which doesn't function correctly on NFS-mounted drives
#4423
Comments
This comment was marked as outdated.
This comment was marked as outdated.
… a newer version of SCT (#4427) When we generate QC reports, we universally update `index.html` with the copy stored in the repo, due to the behavior described in #4423. This can cause problems when, for example, `index.html` and `main.js` are both updated simultaneously between SCT versions (e.g. #4317). In such a case, if QC reports are regenerated using the newer SCT version, `index.html` will be updated with the changes, but `main.js` will not. And, since `index.html` and `main.js` are so interdependent, this can often cause broken behavior in the QC report. So, this PR ensures that the assets are updated alongside `index.html`, but only if the contents differ.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
Ah! It may be that we're dealing with an NFS mount in this situation, in which case wolph/portalocker#92 may apply here:
I'll check in the other issue regarding this. :) EDIT: They were indeed using NFS mounts! |
This comment was marked as resolved.
This comment was marked as resolved.
index.html
, which can cause issues with sct_run_batch
concurrent writesindex.html
which doesn't function correctly on NFS-mounted drives
Assuming the issue here is NFS mounts, then maybe all we need to do is avoid locking on the NFS-mounted drive. Actually, wait a minute here... spinalcordtoolbox/spinalcordtoolbox/reports/qc.py Lines 576 to 579 in a7e538c
There are two distinct steps here:
But, all that really matters is that the "reading" step is done sequentially, right? (In other words, generating each individual JSON file concurrently is OK, as long as each process waits to read in all of the JSON files to generate the new In that case, do we even need to write-lock
|
I think I might have a solution that could kill 2 birds with one stone:
What if we were to isolate this logic inside of a separate, standalone Python script (e.g. This would have two benefits:
|
Background
Our QC reports contain a table of QC entries:
Each entry in the table is stored as simple JSON data listing the subject, date, CLI script, etc. We generate individual
.json
files for each entry via ourqc.py
module.However, when it comes to loading the data into a table in
index.html
, we store this JSON data directly within a JavaScript variable inside theindex.html
file. This means that every time we create a new QC entry using our Python script, we need to completely rewrite theindex.html
file, substituting the JSON data into a placeholder in the HTML template:spinalcordtoolbox/spinalcordtoolbox/reports/qc.py
Line 613 in 1af24e3
spinalcordtoolbox/spinalcordtoolbox/reports/assets/index.html
Line 159 in 1af24e3
Problem
Because all new QC entries have the same destination file, concurrent writes can cause issues with corrupted/missing entries. So, we explicitly lock the
index.html
before writing to it.However, in sct-pipeline/spine-park#15 (comment), we ran into some system errors when trying to lock and write to the
index.html
file while it was on a mounted drive.Proposed solution
Initially, I can think of two ways we could fix this issue:
index.html
file in a tmpdir on a non-mounted drive, then copy the file to the destination directory whensct_run_batch
is complete.Try to eliminate the need for locking entirely.EDIT: See this comment for details on why loading the JSON data using client-side JavaScript probably isn't feasible.The text was updated successfully, but these errors were encountered: