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

Update to match neurodatascience/nipoppy:main #67

Merged
merged 1 commit into from
Jul 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions nipoppy_cli/nipoppy/workflows/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -357,12 +357,6 @@ def run_main(self, **kwargs):
f": {exception}"
)

def run_cleanup(self, **kwargs):
"""Run pipeline cleanup."""
if self.dpath_pipeline_work.exists():
self.rm(self.dpath_pipeline_work)
return super().run_cleanup(**kwargs)

@abstractmethod
def get_participants_sessions_to_run(
self, participant_id: Optional[str], session_id: Optional[str]
Expand Down
5 changes: 3 additions & 2 deletions nipoppy_cli/nipoppy/workflows/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,7 @@ def run_single(self, participant_id: str, session_id: str):

def run_cleanup(self, **kwargs):
"""Run pipeline runner cleanup."""
if self.dpath_pipeline_bids_db.exists():
self.rm(self.dpath_pipeline_bids_db)
for dpath in [self.dpath_pipeline_bids_db, self.dpath_pipeline_work]:
if dpath.exists():
self.rm(dpath)
return super().run_cleanup(**kwargs)
17 changes: 17 additions & 0 deletions nipoppy_cli/tests/test_workflow_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,23 @@ def test_run_setup(config: Config, tmp_path: Path):
assert runner.dpath_pipeline_work.exists()


def test_run_cleanup(tmp_path: Path):
runner = PipelineRunner(
dpath_root=tmp_path / "my_dataset",
pipeline_name="dummy_pipeline",
pipeline_version="1.0.0",
)
dpaths = [
runner.dpath_pipeline_bids_db,
runner.dpath_pipeline_work,
]
for dpath in dpaths:
dpath.mkdir(parents=True)
runner.run_cleanup()
for dpath in dpaths:
assert not dpath.exists()


@pytest.mark.parametrize("simulate", [True, False])
def test_launch_boutiques_run(simulate, config: Config, tmp_path: Path):
runner = PipelineRunner(
Expand Down
11 changes: 11 additions & 0 deletions nipoppy_cli/tests/test_workflow_tracker.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,3 +232,14 @@ def test_run_cleanup(tracker: PipelineTracker, bagel: Bagel):

assert tracker.layout.fpath_imaging_bagel.exists()
assert Bagel.load(tracker.layout.fpath_imaging_bagel).equals(bagel)


def test_run_no_create_work_directory(tracker: PipelineTracker):
tracker.run()
assert not tracker.dpath_pipeline_work.exists()


def test_run_no_rm_work_directory(tracker: PipelineTracker):
tracker.dpath_pipeline_work.mkdir(parents=True)
tracker.run()
assert tracker.dpath_pipeline_work.exists()
Loading