Skip to content
Snippets Groups Projects
Commit 5613f9e6 authored by Nate Richman's avatar Nate Richman :headphones:
Browse files

Merge branch 'GEAR-2289-file-reload' into 'main'

MAIN: Reload files by default on legacy script

Closes GEAR-2289

See merge request flywheel-io/flywheel-apps/hierarchy-curator!24
parents 4461fbcb 139835f7
No related branches found
No related tags found
1 merge request!24MAIN: Reload files by default on legacy script
Pipeline #504117858 passed
# Release Notes
## 2.1.2
__Bug__:
* Enforce default curator `reload()` for legacy scripts
* `reload()` is also performed on `files` as well as containers by default
## 2.1.1
__Maintenance__:
......
......@@ -211,7 +211,7 @@ def run_legacy(
setattr(curator, "input_file_two", curator.additional_input_two)
setattr(curator, "input_file_three", curator.additional_input_three)
# TODO: Rename input_file_one to additional_input_one, etc.
project_walker = walker.Walker(parent, depth_first=curator.depth_first)
project_walker = walker.Walker(parent, depth_first=curator.depth_first, reload=True)
try: # pragma: no cover
for container in project_walker.walk():
curator.curate_container(container) # Tested in gear toolkit
......
{
"name": "hierarchy-curator",
"label": "Hierarchy Curator",
"description": "Curates a container in the flywheel hierarchy given a python HierarchyCurator class. Using an implementation of the HierarchyCurator Class (provided as an input file (e.g., curator.py)) this gear is able to curate an entire project, walking down the hierarchy through project, subject, session, acquisition, analysis, and file containers.",
"version": "2.1.1",
"custom": {
"gear-builder": {
"category": "analysis",
"image": "flywheel/hierarchy-curator:2.1.1"
"name": "hierarchy-curator",
"label": "Hierarchy Curator",
"description": "Curates a container in the flywheel hierarchy given a python HierarchyCurator class. Using an implementation of the HierarchyCurator Class (provided as an input file (e.g., curator.py)) this gear is able to curate an entire project, walking down the hierarchy through project, subject, session, acquisition, analysis, and file containers.",
"version": "2.1.2",
"custom": {
"gear-builder": {
"category": "analysis",
"image": "flywheel/hierarchy-curator:2.1.2"
},
"flywheel": {
"suite": "Curation"
}
},
"flywheel": {
"suite": "Curation"
}
},
"inputs": {
"api-key": {
"base": "api-key"
"inputs": {
"api-key": {
"base": "api-key"
},
"curator": {
"base": "file",
"description": "A python implementation of the Curator class (see https://github.com/flywheel-apps/custom-curator for more details).",
"type": {
"enum": [
"source data"
]
}
},
"additional-input-one": {
"base": "file",
"optional": true,
"description": "An optional input for curation."
},
"additional-input-two": {
"base": "file",
"description": "An optional input for curation.",
"optional": true
},
"additional-input-three": {
"base": "file",
"description": "An optional input for curation.",
"optional": true
}
},
"curator": {
"base": "file",
"description": "A python implementation of the Curator class (see https://github.com/flywheel-apps/custom-curator for more details).",
"type": {
"enum": [
"source data"
]
}
"config": {
"debug": {
"description": "Log debug messages",
"type": "boolean",
"default": false
}
},
"additional-input-one": {
"base": "file",
"optional": true,
"description": "An optional input for curation."
"environment": {
"PATH": "/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
"LANG": "C.UTF-8",
"GPG_KEY": "E3FF2839C048B25C084DEBE9B26995E310250568",
"PYTHON_VERSION": "3.8.13",
"PYTHON_PIP_VERSION": "22.0.4",
"PYTHON_SETUPTOOLS_VERSION": "57.5.0",
"PYTHON_GET_PIP_URL": "https://github.com/pypa/get-pip/raw/38e54e5de07c66e875c11a1ebbdb938854625dd8/public/get-pip.py",
"PYTHON_GET_PIP_SHA256": "e235c437e5c7d7524fbce3880ca39b917a73dc565e0c813465b7a7a329bb279a",
"FLYWHEEL": "/flywheel/v0"
},
"additional-input-two": {
"base": "file",
"description": "An optional input for curation.",
"optional": true
},
"additional-input-three": {
"base": "file",
"description": "An optional input for curation.",
"optional": true
}
},
"config": {
"debug": {
"description": "Log debug messages",
"type": "boolean",
"default": false
}
},
"environment": {},
"command": "poetry run python run.py",
"author": "Flywheel",
"maintainer": "Flywheel <support@flywheel.io>",
"cite": "",
"license": "MIT",
"source": "https://gitlab.com/flywheel-io/flywheel-apps/hierarchy-curator",
"url": "https://gitlab.com/flywheel-io/flywheel-apps/hierarchy-curator"
}
"command": "poetry run python run.py",
"author": "Flywheel",
"maintainer": "Flywheel <support@flywheel.io>",
"cite": "",
"license": "MIT",
"source": "https://gitlab.com/flywheel-io/flywheel-apps/hierarchy-curator",
"url": "https://gitlab.com/flywheel-io/flywheel-apps/hierarchy-curator"
}
\ No newline at end of file
source diff could not be displayed: it is too large. Options to address this: view the blob.
......@@ -17,7 +17,8 @@ license = "MIT"
fw-file = "^1"
flywheel-sdk = "^15.8.0"
backoff = "^1.11.1"
flywheel-gear-toolkit = {version = "^0.5", extras = ["all"]}
flywheel-gear-toolkit = {version = "^0.6.1", extras = ["all"]}
[tool.poetry.dev-dependencies]
pytest = "^6.1.2"
......@@ -27,7 +28,7 @@ license = "MIT"
pylint = "^2.6.0"
pycodestyle = "^2.6.0"
pydocstyle = "^5.1.1"
black = "^20.8b1"
black = "^22"
isort = "^5.6.4"
rpdb = "^0.1.6"
remote-pdb = "^2.1.0"
......
......@@ -222,6 +222,11 @@ def test_curate_errors(fw_project, oneoff_curator, mocker, containers):
def test_curate_main_depth_first(fw_project, oneoff_curator, mocker, containers):
project = fw_project(n_subs=2)
curator_path = ASSETS_DIR / "dummy_curator.py"
for subject in project.subjects():
for session in subject.sessions():
for acq in session.acquisitions():
for file_ in acq.files:
file_.reload = lambda: file_
get_curator_patch = mocker.patch("fw_gear_hierarchy_curator.curate.c.get_curator")
......@@ -277,6 +282,13 @@ def test_curate_main_breadth_first(
):
project = fw_project(n_subs=2)
curator_path = ASSETS_DIR / "dummy_curator.py"
# Hack to get around `reload` not being defined in
# flywheel_gear_toolkit.testing.hierarchy.MockFileEntry
for subject in project.subjects():
for session in subject.sessions():
for acq in session.acquisitions():
for file_ in acq.files:
file_.reload = lambda: file_
get_curator_patch = mocker.patch("fw_gear_hierarchy_curator.curate.c.get_curator")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment