-
Notifications
You must be signed in to change notification settings - Fork 1
/
ecs_stat.py
executable file
·28 lines (22 loc) · 949 Bytes
/
ecs_stat.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
#!/usr/bin/env python
import argparse
from ecs_stat.ecs import ECS
from ecs_stat import ecs_actions
if __name__ == '__main__':
parser = argparse.ArgumentParser(description='ECS status')
parser.add_argument('--tail_logs', action='store', required=False,
help='<cluster_n>,<service_n>,<task_n>,<container_n>')
args = parser.parse_args()
my_ecs = ECS()
if (args.tail_logs):
[cluster, service, task, container] = args.tail_logs.split(',')
container = my_ecs.get_container_by_branch(int(cluster),
int(service),
int(task),
int(container))
print 'Going to tail logs for: %s' % container
from time import sleep
sleep(1)
ecs_actions.tail_logs(container)
else:
ecs_actions.print_ecs_tree(my_ecs)