-
Notifications
You must be signed in to change notification settings - Fork 33
Expand file tree
/
Copy pathrun.py
More file actions
executable file
·29 lines (23 loc) · 853 Bytes
/
Copy pathrun.py
File metadata and controls
executable file
·29 lines (23 loc) · 853 Bytes
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
#!/bin/env python3
# pylint: disable=no-value-for-parameter
from importlib import import_module
from pathlib import Path
from src.disk import disk
import click
from loguru import logger
@click.command()
@click.argument('config_file',
type=click.Path(exists=True, dir_okay=False, readable=True),
default='./src/config/color.py')
@click.option('--yadisk', '--enable_disk',
is_flag=True, show_default=True, default=False, help='Enable uploading checkpoints to Yandex.Disk')
@logger.catch
def run(config_file, yadisk):
config_file = Path(config_file)
config_file = (config_file.parent / config_file.stem).as_posix().replace('/', '.')
imported = import_module(config_file)
disk.set_disabled(not yadisk)
config = imported.Config()
config.run()
if __name__ == '__main__':
run()