-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.py
27 lines (24 loc) · 1.07 KB
/
main.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
from os.path import dirname, join, realpath
import shutil
from preprocessors.load import instantiate, load_config
import logging
from azure_run.run import Run
from azure_run import datastore
import pathlib
config_name = "azure"
def my_app(config_name):
base_dir = dirname(realpath(__file__))
config_path = join(base_dir, 'configs')
cfg = load_config(join(config_path, config_name+'.yaml'))
pathlib.Path(cfg.paths.output_dir).mkdir(parents=True, exist_ok=True)
shutil.copyfile(join(config_path, config_name+'.yaml'), join(cfg.paths.output_dir, 'config.yaml'))
logging.basicConfig(filename=join(cfg.paths.output_dir, cfg.run_name+'.log'), level=logging.INFO,
format='%(asctime)s - %(name)s - %(levelname)s - %(message)s')
logger = logging.getLogger(__name__)
run = Run
run.name(cfg.run_name)
ds_sp = datastore(cfg.data_store)
preprocessor = instantiate(cfg.preprocessor, {'cfg':cfg, 'logger':logger, 'datastore':ds_sp, 'dump_path': cfg.paths.dump_path})
preprocessor()
if __name__=='__main__':
my_app(config_name)