-
Notifications
You must be signed in to change notification settings - Fork 20
/
swarm_s.py
31 lines (25 loc) · 863 Bytes
/
swarm_s.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
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import argparse
from socket import timeout
from lib.core.sswarm import SSwarm
from lib.core.logger import init_logger
from lib.core.logger import LOG
from lib.core.exception import SwarmBaseException
def main():
try:
parser=argparse.ArgumentParser()
parser.add_argument('-p',dest='s_port',metavar='LISTEN PORT',type=int,required=True,
help="Listen port to receive info from master")
args=parser.parse_args()
init_logger('/var/log/swarm_s.log',True,False)
sswarm=SSwarm(args.s_port)
# Parse arguments from mswarm
sswarm.get_parse_args()
# Ready to get and exec command from master host
sswarm.get_do_task()
except SwarmBaseException as e:
LOG.debug(str(e))
return
if __name__=='__main__':
main()