-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcli.py
executable file
·32 lines (24 loc) · 901 Bytes
/
cli.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
#!/usr/bin/env python
# -*- coding:utf-8 -*-
# vim: set number tw=0 shiftwidth=4 tabstop=4 expandtab:
import fire
import config
from api.marathon_api import MarathonHelper
from utils.zk_util import ZKHelper
class MarathonCli(object):
def __init__(self):
self.api = MarathonHelper(username=config.MARATHON_USER, password=config.MARATHON_PASSWD)
self.zkClient = ZKHelper(config.KAFKA_ZK)
def group(self, action, groups="/logstash,/hangout"):
assert action in ["pause", "start"]
if action == "pause":
m_grps = groups.split(",")
self.api.pause_groups(m_grps)
elif action == "start":
self.api.restore_apps()
def app(self, apps, action):
assert action in ["pause", "start"]
def bulk_zk_rm(self):
self.zkClient.remove_invalid_consumers()
if __name__ == '__main__':
fire.Fire(MarathonCli)