-
Notifications
You must be signed in to change notification settings - Fork 6
/
main.py
executable file
·56 lines (45 loc) · 1.64 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
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
#!/usr/bin/env python3
import argparse
from dmrunner.runner import DMRunner, RUNNER_COMMANDS
"""
TODO:
* Proper logging
* Implement --rebuild to run secondary processes for frontend-build:watch on frontend apps
* Big ol' refactor
* nix-shell can't clone repos at the moment
Run functional tests at end of setup
Get rid of self._apps (should be part of DMProcess)
Refactor DMService/DMProcess overlap
"""
def main():
parser = argparse.ArgumentParser()
parser.add_argument(
"--rebuild",
"-r",
action="store_true",
help="Do a rebuild for all apps (equivalent to using `invoke run-all`). This will take "
"longer on initial startup but will help to ensure everything is in the best state.",
)
parser.add_argument(
"--config-path",
"-c",
type=str,
default="config/config.yml",
help="Path to your configuration file, which will be created from the example config if it does"
"not already exist (default: config/config.yml).",
)
parser.add_argument(
"command",
type=str,
default="run",
choices=RUNNER_COMMANDS,
help="'config': Creates a local copy of configuration for you to edit.\n"
" 'setup': Performs setup and checks that your environment meets DM requirements.\n"
" 'data': Abridged setup to clean and refresh Postgres and Elasticsearch data.\n"
" 'run': Run the Digital Marketplace (default)",
)
args = parser.parse_args()
runner = DMRunner(command=args.command.lower(), rebuild=args.rebuild, config_path=args.config_path)
runner.run()
if __name__ == "__main__":
main()