本文整理汇总了Python中Cobalt.Proxy.ComponentProxy.set_jobs方法的典型用法代码示例。如果您正苦于以下问题:Python ComponentProxy.set_jobs方法的具体用法?Python ComponentProxy.set_jobs怎么用?Python ComponentProxy.set_jobs使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cobalt.Proxy.ComponentProxy
的用法示例。
在下文中一共展示了ComponentProxy.set_jobs方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: str
# 需要导入模块: from Cobalt.Proxy import ComponentProxy [as 别名]
# 或者: from Cobalt.Proxy.ComponentProxy import set_jobs [as 别名]
# for c in copy:
# c['state'] = 'user hold'
# spec += copy
if opts['queue']:
updates['queue'] = opts['queue']
if opts['index']:
updates['index'] = opts['index']
if opts['time']:
try:
minutes = Cobalt.Util.get_time(opts['time'])
except Cobalt.Exceptions.TimeFormatError, e:
print "invalid time specification: %s" % e.args[0]
sys.exit(1)
updates['walltime'] = str(minutes)
try:
response = []
if updates:
response = cqm.set_jobs(spec, updates, whoami)
except xmlrpclib.Fault, flt:
response = []
if flt.faultCode == 30 or flt.faultCode == 42:
print flt.faultString
raise SystemExit, 1
else:
print flt.faultString
raise SystemExit, 1
if not response:
Cobalt.Logging.logging.error("Failed to match any jobs or queues")
else:
Cobalt.Logging.logging.debug(response)
示例2:
# 需要导入模块: from Cobalt.Proxy import ComponentProxy [as 别名]
# 或者: from Cobalt.Proxy.ComponentProxy import set_jobs [as 别名]
except ConfigParser.NoOptionError:
filters = []
try:
jobdata = cqm.get_jobs(spec)
except xmlrpclib.Fault, flt:
print flt.faultString
raise SystemExit, 1
if not jobdata:
print "Failed to match any jobs"
sys.exit(1)
response = []
for jobinfo in jobdata:
original_spec = jobinfo.copy()
jobinfo.update({'queue': queue})
for filt in filters:
Cobalt.Util.processfilter(filt, jobinfo)
try:
[job] = cqm.set_jobs([original_spec], jobinfo, user)
response.append("moved job %d to queue '%s'" % (job.get('jobid'), job.get('queue')))
except xmlrpclib.Fault, flt:
response.append(flt.faultString)
if not response:
logger.error("Failed to match any jobs or queues")
else:
logger.debug(response)
for line in response:
print line
示例3: list
# 需要导入模块: from Cobalt.Proxy import ComponentProxy [as 别名]
# 或者: from Cobalt.Proxy.ComponentProxy import set_jobs [as 别名]
check_response = cqm.get_jobs(check_specs)
except xmlrpclib.Fault, flt:
print flt.faultString
raise SystemExit, 1
jobs_existed = [j.get('jobid') for j in check_response]
all_jobs = all_jobs.union(set(jobs_existed))
update_specs = [{'tag':'job', 'user':user, 'jobid':jobid, 'user_hold':"*", 'is_active':"*"} for jobid in jobs_existed]
if opt.deps:
updates = {'all_dependencies': []}
else:
updates = {'user_hold':False}
try:
update_response = cqm.set_jobs(update_specs, updates, user)
except xmlrpclib.Fault, flt:
print flt.faultString
raise SystemExit, 1
if opt.deps:
print " Removed dependencies from jobs: "
for j in update_response:
print " %s" % j.get("jobid")
sys.exit(0)
jobs_found = [j.get('jobid') for j in update_response]
jobs_not_found = list(all_jobs.difference(set(jobs_existed)))
jobs_completed = [j.get('jobid') for j in update_response if j.get('has_completed')] + \
list(set(jobs_existed).difference(set(jobs_found)))
jobs_had_hold = [j.get('jobid') for j in check_response if j.get('user_hold') and j.get('jobid') in jobs_found]