-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathrun.py
More file actions
executable file
·51 lines (38 loc) · 1.2 KB
/
run.py
File metadata and controls
executable file
·51 lines (38 loc) · 1.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/usr/bin/env python
import logging
import flywheel
from flywheel_gear_toolkit import GearToolkitContext
from flywheel_gear_toolkit.utils import datatypes
from flywheel_gear_toolkit.utils.curator import get_curator
from fw_gear_file_curator import parser
log = logging.getLogger(__name__)
def curate(
context: GearToolkitContext,
file_input: flywheel.FileEntry,
curator_path: datatypes.PathLike,
**kwargs,
) -> None: # pragma: no cover
curator = get_curator(context, curator_path, **kwargs)
curator.curate_container(file_input)
def main(context: GearToolkitContext) -> None: # pragma: no cover
(
curator_path,
file_input,
optional_inputs,
) = parser.parse_config(context)
input_filename = file_input.get("location").get("name")
log.info(f"Curating {input_filename}")
curate(
context,
file_input,
curator_path,
**optional_inputs,
)
# update input file tag
tag = context.config.get("tag")
if tag:
context.metadata.add_file_tags(file_input, tags=tag)
if __name__ == "__main__": # pragma: no cover
with GearToolkitContext() as context:
context.init_logging()
main(context)