add nodeid instanceid
This commit is contained in:
parent
d84f116255
commit
bb7048760e
27
f7/app.py
27
f7/app.py
@ -9,6 +9,8 @@ import traceback
|
||||
import tornado.web
|
||||
import tornado.ioloop
|
||||
|
||||
from optparse import OptionParser
|
||||
|
||||
class _mainHandler(tornado.web.RequestHandler):
|
||||
|
||||
def get(self):
|
||||
@ -29,6 +31,9 @@ class _App:
|
||||
self.ext = {}
|
||||
self._listened = False
|
||||
self._requestHandler = {}
|
||||
self._nodeId = 0
|
||||
self._instanceId = 0
|
||||
self.parseOpt()
|
||||
self._app = tornado.web.Application([
|
||||
(r"/webapp/index[\.]php", _mainHandler),
|
||||
])
|
||||
@ -37,6 +42,28 @@ class _App:
|
||||
self._immsgList = []
|
||||
tornado.ioloop.PeriodicCallback(self._processIMMsg, 100).start()
|
||||
|
||||
def parseOpt(self):
|
||||
parser = OptionParser(usage="%prog [options]")
|
||||
parser.add_option("-n",
|
||||
"--node_id",
|
||||
type = 'int',
|
||||
dest = "node_id",
|
||||
help = "node_id")
|
||||
parser.add_option("-i",
|
||||
"--instance_id",
|
||||
type = 'int',
|
||||
dest = "instance_id",
|
||||
help = "instance_id")
|
||||
(options, args) = parser.parse_args()
|
||||
self._nodeId = options.node_id
|
||||
self._instanceId = options.instance_id
|
||||
|
||||
def getNodeId(self):
|
||||
return self._nodeId
|
||||
|
||||
def getInstanceId(self):
|
||||
return self._instanceId
|
||||
|
||||
def init(self, log_dir):
|
||||
f7.udplog.init()
|
||||
f7.udplog.setLogDirAndCreate(log_dir)
|
||||
|
Loading…
x
Reference in New Issue
Block a user