本文整理汇总了Python中supervisor.states.getProcessStateDescription函数的典型用法代码示例。如果您正苦于以下问题:Python getProcessStateDescription函数的具体用法?Python getProcessStateDescription怎么用?Python getProcessStateDescription使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getProcessStateDescription函数的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _assertInState
def _assertInState(self, *states):
if self.state not in states:
current_state = getProcessStateDescription(self.state)
allowable_states = ' '.join(map(getProcessStateDescription, states))
self.config.options.logger.error("Assertion ERROR: current_state(%s) not in expected(%s)" % current_state, allowable_states)
raise AssertionError('Assertion failed for %s: %s not in %s' % (
self.config.name, current_state, allowable_states))
示例2: _assertInState
def _assertInState(self, *states):
if self.state not in states:
current_state = getProcessStateDescription(self.state)
allowable_states = " ".join(map(getProcessStateDescription, states))
raise AssertionError(
"Assertion failed for %s: %s not in %s" % (self.config.name, current_state, allowable_states)
)
示例3: _assertInState
def _assertInState(self, *states):
if self.state not in states:
current_state = getProcessStateDescription(self.state)
allowable_states = ' '.join(map(getProcessStateDescription, states))
processname = as_string(self.config.name)
raise AssertionError('Assertion failed for %s: %s not in %s' % (
processname, current_state, allowable_states))
示例4: payload
def payload(self):
groupname = ''
if self.process.group is not None:
groupname = self.process.group.config.name
L = [('processname', self.process.config.name), ('groupname', groupname),
('from_state', getProcessStateDescription(self.from_state))]
L.extend(self.extra_values)
s = ' '.join( [ '%s:%s' % (name, val) for (name, val) in L ] )
return s
示例5: __repr__
def __repr__(self):
# repr can't return anything other than a native string,
# but the name might be unicode - a problem on Python 2.
name = self.config.name
if PY2:
name = as_string(name).encode('unicode-escape')
return '<Subprocess at %s with name %s in state %s>' % (
id(self),
name,
getProcessStateDescription(self.get_state()))
示例6: getProcessInfo
def getProcessInfo(self, name):
""" Get info about a process named name
@param string name The name of the process (or 'group:name')
@return struct result A structure containing data about the process
"""
self._update('getProcessInfo')
group, process = self._getGroupAndProcess(name)
if process is None:
raise RPCError(Faults.BAD_NAME, name)
# TODO timestamps are returned as xml-rpc integers for b/c but will
# saturate the xml-rpc integer type in jan 2038 ("year 2038 problem").
# future api versions should return timestamps as a different type.
start = capped_int(process.laststart)
stop = capped_int(process.laststop)
now = capped_int(self._now())
state = process.get_state()
spawnerr = process.spawnerr or ''
exitstatus = process.exitstatus or 0
stdout_logfile = process.config.stdout_logfile or ''
stderr_logfile = process.config.stderr_logfile or ''
info = {
'name':process.config.name,
'group':group.config.name,
'start':start,
'stop':stop,
'now':now,
'state':state,
'statename':getProcessStateDescription(state),
'spawnerr':spawnerr,
'exitstatus':exitstatus,
'logfile':stdout_logfile, # b/c alias
'stdout_logfile':stdout_logfile,
'stderr_logfile':stderr_logfile,
'pid':process.pid,
}
description = self._interpretProcessInfo(info)
info['description'] = description
return info
示例7: shutdown_report
def shutdown_report(self):
unstopped = []
for group in self.process_groups.values():
unstopped.extend(group.get_unstopped_processes())
if unstopped:
# throttle 'waiting for x to die' reports
now = time.time()
if now > (self.lastshutdownreport + 3): # every 3 secs
names = [p.config.name for p in unstopped]
namestr = ', '.join(names)
self.options.logger.info('waiting for %s to die' % namestr)
self.lastshutdownreport = now
for proc in unstopped:
state = getProcessStateDescription(proc.get_state())
self.options.logger.blather('%s state: %s' % (proc.config.name, state))
return unstopped
示例8: getProcessInfo
def getProcessInfo(self, name):
""" Get info about a process named name
:param name: The name of the process (or 'group:name')
:type name: string
:return: A structure containing data about the process
:rtype: struct
"""
self._update('getProcessInfo')
group, process = self._getGroupAndProcess(name)
if process is None:
raise RPCError(Faults.BAD_NAME, name)
start = int(process.laststart)
stop = int(process.laststop)
now = int(time.time())
state = process.get_state()
spawnerr = process.spawnerr or ''
exitstatus = process.exitstatus or 0
stdout_logfile = process.config.stdout_logfile or ''
stderr_logfile = process.config.stderr_logfile or ''
info = {
'name':process.config.name,
'group':group.config.name,
'start':start,
'stop':stop,
'now':now,
'state':state,
'statename':getProcessStateDescription(state),
'spawnerr':spawnerr,
'exitstatus':exitstatus,
'logfile':stdout_logfile, # b/c alias
'stdout_logfile':stdout_logfile,
'stderr_logfile':stderr_logfile,
'pid':process.pid,
}
description = self._interpretProcessInfo(info)
info['description'] = description
return info
示例9: getProcessInfo
def getProcessInfo(self, name):
""" Get info about a process named name
@param string name The name of the process (or 'group:name')
@return struct result A structure containing data about the process
"""
self._update("getProcessInfo")
group, process = self._getGroupAndProcess(name)
if process is None:
raise RPCError(Faults.BAD_NAME, name)
start = int(process.laststart)
stop = int(process.laststop)
now = int(time.time())
state = process.get_state()
spawnerr = process.spawnerr or ""
exitstatus = process.exitstatus or 0
stdout_logfile = process.config.stdout_logfile or ""
stderr_logfile = process.config.stderr_logfile or ""
info = {
"name": process.config.name,
"group": group.config.name,
"start": start,
"stop": stop,
"now": now,
"state": state,
"statename": getProcessStateDescription(state),
"spawnerr": spawnerr,
"exitstatus": exitstatus,
"logfile": stdout_logfile, # b/c alias
"stdout_logfile": stdout_logfile,
"stderr_logfile": stderr_logfile,
"pid": process.pid,
}
description = self._interpretProcessInfo(info)
info["description"] = description
return info
示例10: getProcessInfo
def getProcessInfo(self, name):
""" Get info about a process named name
@param string name The name of the process (or 'group:name')
@return struct result A structure containing data about the process
"""
self._update('getProcessInfo')
group, process = self._getGroupAndProcess(name)
start = int(process.laststart)
stop = int(process.laststop)
now = int(time.time())
state = process.get_state()
spawnerr = process.spawnerr or ''
exitstatus = process.exitstatus or 0
stdout_logfile = process.config.stdout_logfile or ''
stderr_logfile = process.config.stderr_logfile or ''
info = {
'name':process.config.name,
'group':group.config.name,
'start':start,
'stop':stop,
'now':now,
'state':state,
'statename':getProcessStateDescription(state),
'spawnerr':spawnerr,
'exitstatus':exitstatus,
'logfile':stdout_logfile, # b/c alias
'stdout_logfile':stdout_logfile,
'stderr_logfile':stderr_logfile,
'restartsignal': process.config.restartsignal,
'pid':process.pid,
}
description = self._interpretProcessInfo(info)
info['description'] = description
return info
示例11: test_getProcessStateDescription_returns_None_when_not_found
def test_getProcessStateDescription_returns_None_when_not_found(self):
self.assertEqual(states.getProcessStateDescription(3.14159),
None)
示例12: test_getProcessStateDescription_returns_string_when_found
def test_getProcessStateDescription_returns_string_when_found(self):
state = states.ProcessStates.STARTING
self.assertEqual(states.getProcessStateDescription(state),
'STARTING')
示例13: __repr__
def __repr__(self):
return '<Subprocess at %s with name %s in state %s>' % (
id(self),
self.config.name,
getProcessStateDescription(self.get_state()))
示例14: _get_state_desc
def _get_state_desc(state):
desc = getProcessStateDescription(state)
if desc:
return desc
return str(state)