本文整理汇总了Python中mpx.service.ServiceNode类的典型用法代码示例。如果您正苦于以下问题:Python ServiceNode类的具体用法?Python ServiceNode怎么用?Python ServiceNode使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ServiceNode类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: start
def start(self):
if self.has_child('columns'):
_positions = []
columns = []
for child in self.get_child('columns').children_nodes():
if child.position in _positions:
raise EConfiguration(('One or more columns ' +
'have the same position'))
_positions.append(child.position)
column = ColumnConfiguration()
column.configure(child.configuration())
columns.append(column)
_positions.sort()
if _positions != range(0,len(_positions)):
raise EConfiguration((
'Columns do not have consecutive positions this '
'can be caused by having two columns with the same name.'
))
self.log.configure(columns,self.minimum_size,self.maximum_size)
else:
self.log.set_limits(self.minimum_size,self.maximum_size)
self.log.start_trimming() # Turn log trimming on now that sizes are set
self.forwarder.start_forwarding(self.log)
ServiceNode.start(self)
return
示例2: configure
def configure(self, config):
ServiceNode.configure(self, config)
set_attribute(self, 'server_url', REQUIRED, config)
set_attribute(self, 'node', REQUIRED, config)
set_attribute(self, 'period', 30, config, int)
set_attribute(self,'connection','/services/network',config,as_node)
set_attribute(self,'timeout',60,config,int)
示例3: configure
def configure(self, config):
ServiceNode.configure(self, config)
set_attribute(self, 'log', self.parent.parent, config, as_node)
set_attribute(self, 'gm_time', 1, config, as_boolean)
self.time_function = time.localtime
if self.gm_time:
self.time_function = time.gmtime
示例4: configure
def configure(self, config):
ServiceNode.configure(self, config)
set_attribute(self, 'heating', REQUIRED, config, as_node)
set_attribute(self, 'cooling', REQUIRED, config, as_node)
set_attribute(self, 'temperature', REQUIRED, config, as_node)
set_attribute(self, 'minimum', REQUIRED, config, float)
set_attribute(self, 'maximum', REQUIRED, config, float)
示例5: __init__
def __init__(self):
ServiceNode.__init__(self)
UTC().configure({'name':'UTC','parent':self})
Local().configure({'name':'local','parent':self})
self._tz_mtime = None
self._in_err = False
self._scheduled = None
示例6: start
def start(self):
ServiceNode.start(self)
# this will correctly add the msglog as a child
# to the logger.
if 'msglog' not in self.children_names():
columns = mpx.lib.msglog.get_columns()
log = Log()
log.configure({'name':'msglog', 'parent':self})
for c in columns:
column = mpx.lib.factory('mpx.service.logger.column')
config = c.configuration()
config['parent'] = log
column.configure(config)
self._logs = PersistentDataObject(self)
self._logs.names = []
self._logs.load()
for name in self._logs.names:
if ((not mpx.lib.log.log_exists(name)) and
(name not in self.children_names())):
log = mpx.lib.log.log(name)
log.destroy()
del(log)
self._logs.names = []
for child in self.children_nodes():
if not isinstance(child, Alias):
# Don't manage other managers' logs...
self._logs.names.append(child.name)
self._logs.save()
示例7: configure
def configure(self, config):
set_attribute(self, 'debug', 0, config, int)
set_attribute(self, 'ip', '', config)
default = '${mpx.properties.%s_PORT}' % self.server_type
set_attribute(self,'port',default,config,int)
set_attribute(self,'user_manager',
as_node('/services/User Manager'),config,as_node)
set_attribute(self,'authentication','form',config)
if (self.authentication is not None and
self.authentication not in ('digest','basic','form')):
raise EInvalidValue('authentication',self.authentication,
'Authentication scheme not recognized.')
set_attribute(self,'port',default,config,int)
set_attribute(self, 'maintenance_interval', 25, config, int)
set_attribute(self, 'zombie_timeout', 600, config, int)
set_attribute(self, 'thread_count', 3, config, int)
if not self.has_child("Request Responder"):
self._setup_request_responder()
if not self.has_child("Authenticator"):
self._setup_authentication_handler()
if not self.has_child("PSP Handler"):
self._setup_psp_handler()
if not self.has_child("JSON-RPC Handler"):
self._setup_json_handler()
ServiceNode.configure(self, config)
示例8: start
def start(self):
if not Server._servers.has_key(self.port):
Server._servers[self.port] = self
self._setup_server()
if Server._thread is None:
Server._thread = _RedusaThread()
Server._thread.start()
ServiceNode.start(self)
示例9: configure
def configure(self,config):
ServiceNode.configure(self,config)
set_attribute(self,'connection','/services/network',config,as_node)
set_attribute(self,'timeout',60,config,int)
set_attribute(self, 'gm_time', 1, config, as_boolean)
self.time_function = time.localtime
if self.gm_time:
self.time_function = time.gmtime
示例10: __init__
def __init__(self):
ServiceNode.__init__(self)
self.debug = 0
self._registered = ()
self._did_save = 0
self._post_configuration=0
if self.debug: print 'Initialized _registered to [] for %s.' % self
示例11: __init__
def __init__(self):
ServiceNode.__init__(self)
self._added_thread_count = 0
self._file_request_handler = None
self.psp_handler = None
self.authenticator = None
self.request_responder = None
self.request_manager = _request.RequestSingleton().request_manager
示例12: __init__
def __init__(self):
self._lock = Lock()
self._started = 0
self._alarm = [] # can have a whole MESS o' alarms at startup...
self._scheduled = None
self.trigger_node_url_posn = None # allow source stamping
self.trigger_node_msg_posn = None # allow source stamping
self._waiting_alarm_sid = None
ServiceNode.__init__(self)
示例13: stop
def stop(self):
if not self._waiting_alarm_sid is None:
try:
scheduler.remove(self._waiting_alarm_sid)
except: # SID may already have expired and been removed...
msglog.exception()
self._waiting_alarm_sid = None
self._started = 0
ServiceNode.stop(self)
return
示例14: start
def start(self):
if not self.__running:
known_alarms = self.get_child('alarms')
for child in known_alarms.children_nodes():
child.event_subscribe(self, AlarmTriggerEvent)
child.event_subscribe(self, AlarmClearEvent)
self.__running = 1
self.__thread = ImmortalThread(name=self.name,target=self.__run)
self.__thread.start()
ServiceNode.start(self)
return
示例15: __init__
def __init__(self):
ServiceNode.__init__(self)
self.transportClass = None # can't be set until we configure security
self.was_enabled = 0
self.enabled = 0
self.start_count = 0
self.stop_count = 0
self.state = self.STOPPED
self.debug = 0
self.__rna_thread = None
return