From 4a78706e112f59ffb3b49022a8f0c497ce8b5e3f Mon Sep 17 00:00:00 2001 From: Marcel Zwiers Date: Wed, 5 Feb 2025 14:08:05 +0100 Subject: [PATCH] Minor tweaks --- bidscoin/__init__.py | 4 +++- bidscoin/cli/_bidsmapper.py | 2 +- docs/CHANGELOG.md | 2 +- docs/_static/dictionary-custom.txt | 1 - docs/workflow.rst | 3 ++- pyproject.toml | 2 +- release_procedure.rst | 6 +++--- 7 files changed, 11 insertions(+), 9 deletions(-) diff --git a/bidscoin/__init__.py b/bidscoin/__init__.py index 5cd115ba..fea53666 100644 --- a/bidscoin/__init__.py +++ b/bidscoin/__init__.py @@ -207,10 +207,12 @@ def trackusage(event: str, dryrun: bool=False) -> dict: except Exception as shelveerror: warnings.warn(f"Please report the following error to the developers:\n{shelveerror}: {trackfile}", RuntimeWarning) - for corruptfile in trackfile.parent.glob(trackfile.name + '.*'): + for corruptfile in shelvefiles := list(trackfile.parent.glob(trackfile.name + '.*')): print(f"Deleting corrupt file: {corruptfile}") corruptfile.unlink() data['event'] = 'trackusage_exception' + if not shelvefiles: # Return without uploading (no shelve files means no sleep) + return data # Upload the usage data try: diff --git a/bidscoin/cli/_bidsmapper.py b/bidscoin/cli/_bidsmapper.py index 1d814e9f..00f28bd7 100755 --- a/bidscoin/cli/_bidsmapper.py +++ b/bidscoin/cli/_bidsmapper.py @@ -42,7 +42,7 @@ def get_parser() -> argparse.ArgumentParser: parser.add_argument('-u','--unzip', help='Wildcard pattern to unpack tarball/zip-files in the sub/ses sourcefolder that need to be unzipped (in a tempdir) to make the data readable. Default: the value of the study/template bidsmap', metavar='PATTERN') parser.add_argument('-s','--store', help='Store newly discovered data samples in the bidsfolder/code/provenance folder (useful for editing e.g. zipped or transferred datasets)', action='store_true') parser.add_argument('-a','--automated', help='Save the automatically generated bidsmap to disk and without interactively tweaking it with the bidseditor', action='store_true') - parser.add_argument('-f','--force', help='Discard the previously saved bidsmap and logfile', action='store_true') + parser.add_argument('-f','--force', help='Discard the previously saved bidsmap and log file, instead of re-using them (use this option for a fresh start)', action='store_true') parser.add_argument('--no-update', help="Do not update any sub-/ses-prefixes in or prepend the sourcefolder name to the <> expression that extracts the subject/session labels. This is normally done to make the extraction more robust, but could cause problems for certain use cases", action='store_true') return parser diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index cd863852..d48fb231 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -255,7 +255,7 @@ The bidscoiner no longer sometimes crashes when dcm2niix produces custom suffixe - Separate tabs for DICOM and PAR to edit all the mappings of mixed datasets in a single bidseditor session - Run-item matching on filesystem properties, i.e. on the pathname, filename and filesize and nr of files in the folder. This can be used in conjunction with the (DICOM/PAR) attributes - A metadata dictionary that can be edited with the bidseditor and that will be added to the json sidecar files by the bidscoiner -- More user feedback in the GUI for new BIDS-compliancy checks on missing or invalid bids data +- More user feedback in the GUI for new BIDS-compliance checks on missing or invalid BIDS data - A right-click menu option to remove a run-item from the bidsmap (advanced usage) - The option to load a new bidsmap in the bidseditor - Enable the user to edit json, yaml, tsv and other non-DICOM/non-PAR files with double-clicks in the data browser diff --git a/docs/_static/dictionary-custom.txt b/docs/_static/dictionary-custom.txt index 009fc1e8..229cf153 100644 --- a/docs/_static/dictionary-custom.txt +++ b/docs/_static/dictionary-custom.txt @@ -163,7 +163,6 @@ bugfixes bval bvec cli -compliancy conda config copymetadata diff --git a/docs/workflow.rst b/docs/workflow.rst index b62cf950..43e009aa 100644 --- a/docs/workflow.rst +++ b/docs/workflow.rst @@ -80,7 +80,8 @@ Here is how to run the bidsmapper command: (useful for editing e.g. zipped or transferred datasets) -a, --automated Save the automatically generated bidsmap to disk and without interactively tweaking it with the bidseditor - -f, --force Discard the previously saved bidsmap and log file + -f, --force Discard the previously saved bidsmap and log file, instead of re-using them + (use this option for a fresh start) --no-update Do not update any sub-/ses-prefixes in or prepend the sourcefolder name to the <> expression that extracts the subject/session labels. This is normally done to make the extraction more robust, but could cause problems diff --git a/pyproject.toml b/pyproject.toml index 85f2468b..2861dcfd 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -130,4 +130,4 @@ commands = make -C docs html skip = '.git,*.pdf,*.svg,go.sum' check-hidden = true ignore-regex = '\b(PULS|TE|ALS)\b' -ignore-words-list = 'compliancy,uptodate,mis' +ignore-words-list = 'uptodate,mis' diff --git a/release_procedure.rst b/release_procedure.rst index a23e52d3..e06ab633 100644 --- a/release_procedure.rst +++ b/release_procedure.rst @@ -53,7 +53,7 @@ DCCN deployment source activate /opt/bidscoin bidscoin -v bidscoin -t - conda deactivate bidscoin + conda deactivate 4. Post a release message on the MM data management channel @@ -92,13 +92,12 @@ Dockerhub sudo docker run --rm marcelzwiers/bidscoin:$VERSION pngappend sudo docker run --rm -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix marcelzwiers/bidscoin:$VERSION bidscoin -t sudo docker push marcelzwiers/bidscoin:$VERSION - sudo docker system prune -a Neurodesk --------- 1. Pull and edit the bidscoin neurocontainer in a separate release branch -2. Build and test a neurodocker image:: +2. In the VM, build and test a neurodocker image:: VERSION="4.5.0" cd ~/PycharmProjects/neurocontainers/recipes/bidscoin @@ -106,6 +105,7 @@ Neurodesk ./build.sh -ds sudo docker image list # Checkout the TAG sudo docker run --rm -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix bidscoin_${VERSION}:TAG bidscoin -t + sudo docker system prune -a 3. Create a neurocontainers PR from the release branch