forked from UCY-LINC-LAB/fogify
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
29 lines (20 loc) · 777 Bytes
/
main.py
File metadata and controls
29 lines (20 loc) · 777 Bytes
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
import argparse
from agent.agent import Agent
from controller.controller import Controller
from flask_api import FlaskAPI
def initialize():
app = FlaskAPI(__name__)
parser = argparse.ArgumentParser()
parser.add_argument('--agent', help='Run agent', default=False, action="store_true")
parser.add_argument('--agent-ip', help='The IP of the agent', default="localhost")
parser.add_argument('--controller', help='Run Controller', action="store_true")
args = parser.parse_args()
if args.agent:
cmd = Agent(args, app)
if args.controller:
cmd = Controller(args, app)
return cmd
cmd = initialize()
app = cmd.app
if __name__ == '__main__':
app.run(debug=False, host='0.0.0.0', port=5500 if type(cmd) == Agent else 5000)