本文整理汇总了Python中grid_control.utils.process_base.LocalProcess.status_raise方法的典型用法代码示例。如果您正苦于以下问题:Python LocalProcess.status_raise方法的具体用法?Python LocalProcess.status_raise怎么用?Python LocalProcess.status_raise使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类grid_control.utils.process_base.LocalProcess
的用法示例。
在下文中一共展示了LocalProcess.status_raise方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _parseTickets
# 需要导入模块: from grid_control.utils.process_base import LocalProcess [as 别名]
# 或者: from grid_control.utils.process_base.LocalProcess import status_raise [as 别名]
def _parseTickets(self, cached = True):
# Return cached results if requested
if cached and self._cache:
return self._cache
# Call klist and parse results
proc = LocalProcess(self._klistExec)
self._cache = {}
try:
for line in proc.stdout.iter(timeout = 10):
if line.count('@') and (line.count(':') > 1):
issued_expires, principal = rsplit(line, ' ', 1)
issued_expires = issued_expires.replace('/', ' ').split()
assert(len(issued_expires) % 2 == 0)
issued_str = str.join(' ', issued_expires[:int(len(issued_expires) / 2)])
expires_str = str.join(' ', issued_expires[int(len(issued_expires) / 2):])
parseDate = lambda value, format: time.mktime(time.strptime(value, format))
if expires_str.count(' ') == 3:
if len(expires_str.split()[2]) == 2:
expires = parseDate(expires_str, '%m %d %y %H:%M:%S')
else:
expires = parseDate(expires_str, '%m %d %Y %H:%M:%S')
elif expires_str.count(' ') == 2: # year information is missing
currentYear = int(time.strftime('%Y'))
expires = parseDate(expires_str + ' %d' % currentYear, '%b %d %H:%M:%S %Y')
issued = parseDate(issued_str + ' %d' % currentYear, '%b %d %H:%M:%S %Y')
if expires < issued: # wraparound at new year
expires = parseDate(expires_str + ' %d' % (currentYear + 1), '%b %d %H:%M:%S %Y')
self._cache.setdefault('tickets', {})[principal] = expires
elif line.count(':') == 1:
key, value = lmap(str.strip, line.split(':', 1))
self._cache[key.lower()] = value
except Exception:
raise AccessTokenError('Unable to parse kerberos ticket information!')
proc.status_raise(timeout = 0)
return self._cache
示例2: _list_endpoint_all
# 需要导入模块: from grid_control.utils.process_base import LocalProcess [as 别名]
# 或者: from grid_control.utils.process_base.LocalProcess import status_raise [as 别名]
def _list_endpoint_all(self):
result = []
proc = LocalProcess(self._lcg_infosites_exec, 'wms')
for line in proc.stdout.iter(timeout=10):
result.append(line.strip())
proc.status_raise(timeout=0)
random.shuffle(result)
return result
示例3: listWMS_all
# 需要导入模块: from grid_control.utils.process_base import LocalProcess [as 别名]
# 或者: from grid_control.utils.process_base.LocalProcess import status_raise [as 别名]
def listWMS_all(self):
result = []
proc = LocalProcess(self._exeLCGInfoSites, 'wms')
for line in proc.stdout.iter(timeout = 10):
result.append(line.strip())
proc.status_raise(timeout = 0)
random.shuffle(result)
return result
示例4: discover
# 需要导入模块: from grid_control.utils.process_base import LocalProcess [as 别名]
# 或者: from grid_control.utils.process_base.LocalProcess import status_raise [as 别名]
def discover(self):
proc = LocalProcess(self._exec)
for line in proc.stdout.iter(timeout=self._timeout):
if not line.startswith(' ') and len(line) > 1:
node = line.strip()
if ('state = ' in line) and ('down' not in line) and ('offline' not in line):
yield {'name': node}
proc.status_raise(timeout=0)
示例5: getNodes
# 需要导入模块: from grid_control.utils.process_base import LocalProcess [as 别名]
# 或者: from grid_control.utils.process_base.LocalProcess import status_raise [as 别名]
def getNodes(self):
result = []
proc = LocalProcess(self._nodesExec)
for line in proc.stdout.iter():
if not line.startswith(' ') and len(line) > 1:
node = line.strip()
if ('state = ' in line) and ('down' not in line) and ('offline' not in line):
result.append(node)
proc.status_raise(timeout = 0)
if len(result) > 0:
return result
示例6: getNodes
# 需要导入模块: from grid_control.utils.process_base import LocalProcess [as 别名]
# 或者: from grid_control.utils.process_base.LocalProcess import status_raise [as 别名]
def getNodes(self):
result = set()
proc = LocalProcess(self._configExec, '-shgrpl')
for group in proc.stdout.iter(timeout = 10):
result.add(group.strip())
proc_g = LocalProcess(self._configExec, '-shgrp_resolved %s' % group)
for host in proc_g.stdout.iter(timeout = 10):
result.update(host.split())
proc_g.status_raise(timeout = 0)
proc.status_raise(timeout = 0)
if len(result) > 0:
return list(result)
示例7: discover
# 需要导入模块: from grid_control.utils.process_base import LocalProcess [as 别名]
# 或者: from grid_control.utils.process_base.LocalProcess import status_raise [as 别名]
def discover(self):
nodes = set()
proc = LocalProcess(self._configExec, '-shgrpl')
for group in proc.stdout.iter(timeout = 10):
yield {'name': group.strip()}
proc_g = LocalProcess(self._configExec, '-shgrp_resolved', group)
for host_list in proc_g.stdout.iter(timeout = 10):
nodes.update(host_list.split())
proc_g.status_raise(timeout = 0)
for host in sorted(nodes):
yield {'name': host.strip()}
proc.status_raise(timeout = 0)
示例8: getQueues
# 需要导入模块: from grid_control.utils.process_base import LocalProcess [as 别名]
# 或者: from grid_control.utils.process_base.LocalProcess import status_raise [as 别名]
def getQueues(self):
queues = {}
tags = ['h_vmem', 'h_cpu', 's_rt']
reqs = dict(izip(tags, [WMS.MEMORY, WMS.CPUTIME, WMS.WALLTIME]))
parser = dict(izip(tags, [int, parseTime, parseTime]))
proc = LocalProcess(self._configExec, '-sql')
for queue in imap(str.strip, proc.stdout.iter(timeout = 10)):
queues[queue] = dict()
proc_q = LocalProcess(self._configExec, '-sq %s' % queue)
for line in proc_q.stdout.iter(timeout = 10):
attr, value = lmap(str.strip, line.split(' ', 1))
if (attr in tags) and (value != 'INFINITY'):
queues[queue][reqs[attr]] = parser[attr](value)
proc_q.status_raise(timeout = 0)
proc.status_raise(timeout = 0)
return queues
示例9: getQueues
# 需要导入模块: from grid_control.utils.process_base import LocalProcess [as 别名]
# 或者: from grid_control.utils.process_base.LocalProcess import status_raise [as 别名]
def getQueues(self):
(queues, active) = ({}, False)
keys = [WMS.MEMORY, WMS.CPUTIME, WMS.WALLTIME]
parser = dict(izip(keys, [int, parseTime, parseTime]))
proc = LocalProcess(self.statusExec, '-q')
for line in proc.stdout.iter(timeout = 10):
if line.startswith('-'):
active = True
elif line.startswith(' '):
active = False
elif active:
fields = lmap(str.strip, line.split()[:4])
queueInfo = {}
for key, value in ifilter(lambda k_v: not k_v[1].startswith('-'), izip(keys, fields[1:])):
queueInfo[key] = parser[key](value)
queues[fields[0]] = queueInfo
proc.status_raise(timeout = 0)
return queues