DevilKing's blog

冷灯看剑,剑上几分功名?炉香无需计苍生,纵一穿烟逝,万丈云埋,孤阳还照古陵

0%

Hydra Config Framework

原repo地址

1
2
3
@hydra.main(config_path='config.yaml')
def my_app(cfg):
print(cfg.pretty())
1
2
3
4
5
$ python my_app.py db.user=root db.pass=1234
db:
driver: mysql
user: root
pass: 1234

config group

1
2
3
4
5
6
$ python my_app.py db=postgresql
db:
driver: postgresql
pass: drowssap
timeout: 10
user: postgre_user

multi-run

1
2
3
4
5
6
7
8
9
$ python tutorial/50_composition/my_app.py schema=warehouse,support,school db=mysql,postgresql -m
[2019-10-01 14:44:16,254] - Launching 6 jobs locally
[2019-10-01 14:44:16,254] - Sweep output dir : multirun/2019-10-01/14-44-16
[2019-10-01 14:44:16,254] - #0 : schema=warehouse db=mysql
[2019-10-01 14:44:16,321] - #1 : schema=warehouse db=postgresql
[2019-10-01 14:44:16,390] - #2 : schema=support db=mysql
[2019-10-01 14:44:16,458] - #3 : schema=support db=postgresql
[2019-10-01 14:44:16,527] - #4 : schema=school db=mysql
[2019-10-01 14:44:16,602] - #5 : schema=school db=postgresql

更多的配置,更多的任务