Skip to content

Commit

Permalink
Update.
Browse files Browse the repository at this point in the history
  • Loading branch information
tsalo committed Nov 8, 2023
1 parent 9c203fd commit 75e2d30
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 5 deletions.
11 changes: 6 additions & 5 deletions aslprep/cli/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -497,12 +497,13 @@ def _bids_filter(value):
"world usage crucial for obtaining funding.",
)
g_other.add_argument(
"--sloppy",
dest="debug",
action="store_true",
default=False,
help="Use low-quality tools for speed - TESTING ONLY",
"--debug",
action="store",
nargs="+",
choices=config.DEBUG_MODES + ("all",),
help="Debug mode(s) to enable. 'all' is alias for all available modes.",
)

latest = check_latest()
if latest is not None and currentv < latest:
print(
Expand Down
18 changes: 18 additions & 0 deletions aslprep/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,11 @@
pass


# Debug modes are names that influence the exposure of internal details to
# the user, either through additional derivatives or increased verbosity
DEBUG_MODES = ("pdb",)


class _Config:
"""An abstract class forbidding instantiation."""

Expand Down Expand Up @@ -322,6 +327,8 @@ class execution(_Config):
"""A path where anatomical derivatives are found to fast-track *sMRIPrep*."""
bids_dir = None
"""An existing path to the dataset, which must be BIDS-compliant."""
bids_database_dir = None
"""Path to the directory containing SQLite database indices for the input BIDS dataset."""
bids_description_hash = None
"""Checksum (SHA256) of the ``dataset_description.json`` of the BIDS dataset."""
bids_filters = None
Expand Down Expand Up @@ -375,6 +382,8 @@ class execution(_Config):
_paths = (
"anat_derivatives",
"bids_dir",
"bids_database_dir",
"aslprep_dir",
"fs_license_file",
"fs_subjects_dir",
"layout",
Expand All @@ -396,6 +405,9 @@ def init(cls):
from bids.layout import BIDSLayout
from bids.layout.index import BIDSLayoutIndexer

_db_path = cls.bids_database_dir or (cls.work_dir / cls.run_uuid / "bids_db")
_db_path.mkdir(exist_ok=True, parents=True)

# Recommended after PyBIDS 12.1
_indexer = BIDSLayoutIndexer(
validate=False,
Expand All @@ -412,8 +424,11 @@ def init(cls):
)
cls._layout = BIDSLayout(
str(cls.bids_dir),
database_path=_db_path,
reset_database=cls.bids_database_dir is None,
indexer=_indexer,
)
cls.bids_database_dir = _db_path

cls.layout = cls._layout
if cls.bids_filters:
Expand All @@ -426,6 +441,9 @@ def init(cls):
for k, v in filters.items()
}

if "all" in cls.debug:
cls.debug = list(DEBUG_MODES)


# These variables are not necessary anymore
del _fs_license
Expand Down

0 comments on commit 75e2d30

Please sign in to comment.