-
Notifications
You must be signed in to change notification settings - Fork 0
/
run.py
25 lines (21 loc) · 841 Bytes
/
run.py
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
import argparse
from importlib import import_module
import yaml
from version import __version__
if __name__ == '__main__':
parser = argparse.ArgumentParser(f'BioImageOperation-B {__version__}')
parser.add_argument('--params',
required=True,
help='The parameters file')
args = parser.parse_args()
with open(args.params, 'r') as file:
params = yaml.safe_load(file)
for operation0 in params['operations']:
operation = next(iter(operation0))
try:
module = import_module(f'src.pipeline.{operation}')
except Exception as e:
raise FileNotFoundError(f'Unknown operation: {operation}\n{e}')
print(f'[Operation: {operation}]')
module.run(params, operation0[operation])
print('All operations completed')