-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun.py
executable file
·48 lines (34 loc) · 1.22 KB
/
run.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
#!/usr/bin/env python
import yaml
import os
import sys
from subprocess import Popen
from time import sleep
from utils import banner
conf = yaml.load(open('./config.yml', 'r'))
def start_all():
print(banner.info('Starting all applications'))
processes = []
for project_id in conf['projects']:
project = conf['projects'][project_id]
path = conf['parameters']['projects_dir'] + '/' + project_id
if not os.path.exists(path):
print(banner.info('Ignoring ' + project['name'] + ' (not installed)'))
continue
properties = yaml.load(open(path + '/.p-properties.yml', 'r'))
if 'run' not in properties:
print(banner.info('Ignoring ' + project['name'] + ' (no running configuration)'))
continue
for command in properties['run']:
print(banner.info('Starting ' + project['name']))
processes.append(Popen(command, shell=True, cwd=path))
sleep(2)
print(banner.success('All projects started!'))
print('Press Ctrl-C to quit.')
for process in processes:
try:
process.wait()
except KeyboardInterrupt:
sys.exit(0)
if __name__ == '__main__':
start_all()