本文整理汇总了Python中supervisor.options.readFile函数的典型用法代码示例。如果您正苦于以下问题:Python readFile函数的具体用法?Python readFile怎么用?Python readFile使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了readFile函数的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _readProcessLog
def _readProcessLog(self, name, offset, length, channel):
group, process = self._getGroupAndProcess(name)
logfile = getattr(process.config, '%s_logfile' % channel)
if logfile is None or not os.path.exists(logfile):
raise RPCError(Faults.NO_FILE, logfile)
try:
return readFile(logfile, int(offset), int(length))
except ValueError, inst:
why = inst.args[0]
raise RPCError(getattr(Faults, why))
示例2: readLog
def readLog(self, offset, length):
""" Read length bytes from the main log starting at offset
@param int offset offset to start reading from.
@param int length number of bytes to read from the log.
@return string result Bytes of log
"""
self._update('readLog')
logfile = self.supervisord.options.logfile
if logfile is None or not os.path.exists(logfile):
raise RPCError(Faults.NO_FILE, logfile)
try:
return readFile(logfile, int(offset), int(length))
except ValueError, inst:
why = inst.args[0]
raise RPCError(getattr(Faults, why))