-
Notifications
You must be signed in to change notification settings - Fork 5
/
cli.py
46 lines (34 loc) · 1.42 KB
/
cli.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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
from mlops.Experiment import Experiment
import click
CONTEXT_SETTINGS = {'help_option_names': ['-h', '--help'],
'show_default': True}
@click.group('cli', context_settings=CONTEXT_SETTINGS)
def cli():
"""
CLI tool for csc-mlops projects.
EXAMPLE:
mlops run scripts/train.py
"""
pass
@cli.command('run', context_settings=CONTEXT_SETTINGS)
@click.argument('script', type=click.Path(exists=True))
@click.option('-c', '--config', 'config_path', help='Path to config file storing parameters for this run',
default='config/config.cfg', type=click.Path())
@click.option('-n', '--name', 'run_name', help='MLFlow run name', default=None)
@click.option('--ignore_git_check', is_flag=True, show_default=True, default=False,
help='TESTING ONLY - ignore git checks, occasionally it might be necessary to ignore the git checks for example, offline testing, do not use this feature if working on tracked models')
def run(script, config_path, run_name, ignore_git_check):
"""
Runs python project using csc-mlops framework.
SCRIPT is the path to the script to run e.g. scripts/train.py
"""
# create Experiment
exp = Experiment(script,
config_path=config_path,
ignore_git_check=ignore_git_check
)
# run Experiment
exp.run(docker_args={},
)
if __name__ == '__main__':
cli()