[ENH]: Introduce WorkDirManager #254
No reviewers
Labels
No labels
CRITICAL
Stale
WIP
bug
concept
coordinate
dataset
dependencies
documentation
duplicate
enhancement
github_actions
good first issue
help wanted
invalid
maintenance
maps
marker
mask
on hold
parcellation
preprocess
question
ready
storage
template-space
triage
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
juaml/junifer!254
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/workdirmanager"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
This PR introduces new
WorkDirManagerclass which allows global access for temporary directories under theworkdirparameter's values from the YAML, across the codebase.Codecov Report
100.00% <ø> (ø)92.81% <81.92%> (-0.23%)Flags with carried forward coverage won't be shown. Click here to find out more.
96.27% <100.00%> (+0.04%)90.47% <100.00%> (-2.39%)100.00% <100.00%> (ø)100.00% <100.00%> (ø)95.45% <77.77%> (-0.06%)68.02% <83.33%> (-0.69%)78.00% <78.00%> (ø)@ -0,0 +1,162 @@"""Provide a work directory manager class to be used by pipeline components."""I would not allow to set the workdir like this, for the resasons stated in the constructor
no prefix here, the root tmp dir should be random.
@ -0,0 +38,4 @@"""def __init__(self, workdir: Optional[Union[str, Path]] = None) -> None:Since it's a singleton, any intialization should take care of cleaning up a previous one.
e.g:
However, if a user does use it wrongly, it might cleanup in the middle.
So I would:
cleanup=Falseparameter to the init@ -0,0 +38,4 @@"""def __init__(self, workdir: Optional[Union[str, Path]] = None) -> None:I've made the changes as you proposed. The problem is that the
__init__()doesn't fire the second time you try to create an instance as it's a singleton, so the previous instance is returned.@ -0,0 +38,4 @@"""def __init__(self, workdir: Optional[Union[str, Path]] = None) -> None:Ok, so how can we fix it?
@ -0,0 +38,4 @@"""def __init__(self, workdir: Optional[Union[str, Path]] = None) -> None:The only way I know of interacting with singletons in principle is to use getters and setters.
@ -0,0 +38,4 @@"""def __init__(self, workdir: Optional[Union[str, Path]] = None) -> None:lets do that then