Skip to content
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: Initialize BIDS layout after cleaning working directory #2741

Merged
merged 1 commit into from
Apr 8, 2022

Conversation

effigies
Copy link
Member

I saw three options.

  1. Protect the PyBIDS DB from being deleted by --clean-workdir. This complicates the cleaning code.
  2. Move cleaning into config.execution.init, which seems bad as I think initialization is supposed to be okay to do multiple times. Destructive filesystem operations certainly seem bad to hide in configuration init.
  3. Have a separate explicit layout initialization step that we call after cleaning the work-dir.

Went for option 3.

Fixes #2721

@effigies effigies added this to the 21.0.2 milestone Mar 10, 2022
Copy link
Collaborator

@mgxd mgxd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what if we just move the clean_directory logic to run before initializing the config?

@effigies
Copy link
Member Author

Because the working directory could be set by passing a config file.

@mgxd
Copy link
Collaborator

mgxd commented Mar 15, 2022

ah yes - in that case, you probably just need to initialize the layout after this line as well

config.load(config_file)

@effigies
Copy link
Member Author

Thanks for tracking that down.

@effigies
Copy link
Member Author

Tests passing. Any objections?

Copy link
Collaborator

@mgxd mgxd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not a big fan of having to call 2 initialization methods (load/initialize_layout) every time we establish the config. I think load by default should call all initialization functions -perhaps what we should be able to handle is selective initialization each config section

But if you feel strongly against, config.execution.init's docstring should be updated with this change in behavior

@effigies
Copy link
Member Author

The config is kind of a house of cards... I'll see what I can do.

@pep8speaks
Copy link

pep8speaks commented Apr 8, 2022

Hello @effigies! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:

There are currently no PEP 8 issues detected in this Pull Request. Cheers! 🍻

Comment last updated at 2022-04-08 15:03:03 UTC

@effigies effigies force-pushed the fix/bids_layout_init branch 2 times, most recently from b3b7762 to dfbfd7f Compare April 8, 2022 15:03
@effigies effigies requested a review from mgxd April 8, 2022 15:11
Copy link
Collaborator

@mgxd mgxd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - thanks for addressing that 😄

@effigies effigies merged commit e53a7c2 into nipreps:maint/21.0.x Apr 8, 2022
@effigies effigies deleted the fix/bids_layout_init branch April 8, 2022 19:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants