-
Notifications
You must be signed in to change notification settings - Fork 2
/
atf
73 lines (65 loc) · 1.92 KB
/
atf
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#!/usr/bin/env python
import click
import os
import sys
import logging
import core.string
from collector.collect import collect_group
from collector.csv2dataset import csv2dataset_group
from collector.dataset2csv import dataset2csv_group
from collector.extract import extract_group
from core.env import initialize_env
from core.logging import init_logging
from core.exceptions import ArgumentError, AtfError
from core.string import TAB
from drive.copy import copy_group
from drive.delete import delete_group
from drive.download import download_group
from drive.upload import upload_group
from model.backtest import backtest_group
from model.evaluate import evaluate_group
from model.predict import predict_group
from model.train import train_group
from settings.set import set_group
from settings.unset import unset_group
from testing.test import test_group
from trader.trade import trade_group
LOGGER = logging.getLogger(__name__)
@click.command(
cls=click.CommandCollection,
sources=[
evaluate_group,
collect_group,
extract_group,
predict_group,
train_group,
test_group,
trade_group,
download_group,
upload_group,
delete_group,
copy_group,
csv2dataset_group,
dataset2csv_group,
backtest_group,
set_group,
unset_group
]
)
@click.option("-D", "env", multiple=True,
help="Set environment variable e.g. -Dvar=value")
@click.option("-E", "--envfile", help="Path to the file with environmental variables' definition", default=None)
def atf(env, envfile):
collected_env = initialize_env(env, envfile)
init_logging()
core.string.initialize()
LOGGER.debug(f"env:\n\t{TAB.join([f'{k}={v}' for k, v in collected_env.items()])}")
def main():
try:
atf()
except AtfError as e:
sys.exit(1)
except RuntimeError as e:
sys.exit(-1)
if __name__ == '__main__':
main()