本文整理汇总了Python中DIRAC.Interfaces.API.Dirac.Dirac.selectJobs方法的典型用法代码示例。如果您正苦于以下问题:Python Dirac.selectJobs方法的具体用法?Python Dirac.selectJobs怎么用?Python Dirac.selectJobs使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DIRAC.Interfaces.API.Dirac.Dirac
的用法示例。
在下文中一共展示了Dirac.selectJobs方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: in
# 需要导入模块: from DIRAC.Interfaces.API.Dirac import Dirac [as 别名]
# 或者: from DIRAC.Interfaces.API.Dirac.Dirac import selectJobs [as 别名]
group = None
jobs = []
for sw, value in Script.getUnprocessedSwitches():
if sw in ( 'D', 'Dir' ):
outputDir = value
elif sw.lower() in ( 'f', 'file' ):
if os.path.exists( value ):
jFile = open( value )
jobs += jFile.read().split()
jFile.close()
elif sw.lower() in ( 'g', 'jobgroup' ):
group = value
jobDate = toString( date() - 30 * day )
# Choose jobs in final state, no more than 30 days old
result = dirac.selectJobs( jobGroup = value, date = jobDate, status = 'Done' )
if not result['OK']:
if not "No jobs selected" in result['Message']:
print "Error:", result['Message']
DIRAC.exit( -1 )
else:
jobs += result['Value']
result = dirac.selectJobs( jobGroup = value, date = jobDate, status = 'Failed' )
if not result['OK']:
if not "No jobs selected" in result['Message']:
print "Error:", result['Message']
DIRAC.exit( -1 )
else:
jobs += result['Value']
for arg in parseArguments( args ):
示例2: Dirac
# 需要导入模块: from DIRAC.Interfaces.API.Dirac import Dirac [as 别名]
# 或者: from DIRAC.Interfaces.API.Dirac.Dirac import selectJobs [as 别名]
selDate = date
if not date:
selDate = 'Today'
conditions = { 'Status':status,
'MinorStatus':minorStatus,
'ApplicationStatus':appStatus,
'Owner':owner,
'JobGroup':jobGroup,
'Date':selDate }
from DIRAC.Interfaces.API.Dirac import Dirac
dirac = Dirac()
result = dirac.selectJobs( status = status,
minorStatus = minorStatus,
applicationStatus = appStatus,
site = site,
owner = owner,
jobGroup = jobGroup,
date = date )
if not result['OK']:
print 'ERROR %s' % result['Message']
exitCode = 2
else:
conds = []
for n, v in conditions.items():
if v:
conds.append( '%s = %s' % ( n, v ) )
jobs = result['Value']
constrained = ' '
if len( jobs ) > 100:
jobs = jobs[:100]
示例3: len
# 需要导入模块: from DIRAC.Interfaces.API.Dirac import Dirac [as 别名]
# 或者: from DIRAC.Interfaces.API.Dirac.Dirac import selectJobs [as 别名]
exitCode = 0
iKey = "FailureReason"
args = Script.getPositionalArgs()
if len(args):
iKey = args[0]
print '*INFO* looking for key %s'%iKey
# first, get all jobs which are marked as stalled
status = "Failed"
minor_stat = "Job stalled: pilot not running"
owner = "zimmer"
dirac = Dirac()
jobs = []
conditions = {"Status":status,"MinorStatus":minor_stat,"Owner":owner}
res = dirac.selectJobs( status = status,
minorStatus = minor_stat,
owner = owner)
if not res['OK']:
gLogger("ERROR retrieving jobs")
gLogger(res["Message"])
exitCode = 2
else:
conds = []
for n, v in conditions.items():
if v:
conds.append( '%s = %s' % ( n, v ) )
jobs = res['Value']
pilot_refs = {}
for job in jobs:
# next get pilot refs
key = job
示例4: Dirac
# 需要导入模块: from DIRAC.Interfaces.API.Dirac import Dirac [as 别名]
# 或者: from DIRAC.Interfaces.API.Dirac.Dirac import selectJobs [as 别名]
from DIRAC.Interfaces.API.Dirac import Dirac, parseArguments
dirac = Dirac()
exitCode = 0
jobs = []
for key, value in Script.getUnprocessedSwitches():
if key.lower() in ( 'f', 'file' ):
if os.path.exists( value ):
jFile = open( value )
jobs += jFile.read().split()
jFile.close()
elif key.lower() in ( 'g', 'jobgroup' ):
jobDate = toString( date() - 30 * day )
# Choose jobs no more than 30 days old
result = dirac.selectJobs( jobGroup = value, date = jobDate )
if not result['OK']:
print "Error:", result['Message']
DIRACExit( -1 )
jobs += result['Value']
if len( args ) < 1 and not jobs:
Script.showHelp()
if len( args ) > 0:
jobs += parseArguments( args )
result = dirac.getJobStatus( jobs )
if result['OK']:
for job in result['Value']:
print 'JobID=' + str( job ),
示例5: Dirac
# 需要导入模块: from DIRAC.Interfaces.API.Dirac import Dirac [as 别名]
# 或者: from DIRAC.Interfaces.API.Dirac.Dirac import selectJobs [as 别名]
from DIRAC.Interfaces.API.Dirac import Dirac
dirac = Dirac()
exitCode = 0
errorList = []
jobs = []
for sw, value in Script.getUnprocessedSwitches():
if sw.lower() in ("f", "file"):
if os.path.exists(value):
jFile = open(value)
jobs += jFile.read().split()
jFile.close()
elif sw.lower() in ("g", "jobgroup"):
group = value
result = dirac.selectJobs(jobGroup=value)
if not result["OK"]:
if not "No jobs selected" in result["Message"]:
print "Error:", result["Message"]
DIRAC.exit(-1)
else:
jobs += result["Value"]
for arg in args:
jobs.append(arg)
if not jobs:
print "Warning: no jobs selected"
Script.showHelp()
DIRAC.exit(0)
示例6: Dirac
# 需要导入模块: from DIRAC.Interfaces.API.Dirac import Dirac [as 别名]
# 或者: from DIRAC.Interfaces.API.Dirac.Dirac import selectJobs [as 别名]
'JobGroup': ','.join(str(jg) for jg in jobGroups),
'Date': selDate}
from DIRAC.Interfaces.API.Dirac import Dirac
dirac = Dirac()
jobs = []
if jobGroups:
for jobGroup in jobGroups:
res = dirac.selectJobs(status=status,
minorStatus=minorStatus,
applicationStatus=appStatus,
site=site,
owner=owner,
jobGroup=jobGroup,
date=date,
printErrors=False)
if res['OK']:
jobs.extend(res['Value'])
else:
gLogger.error("Can't select jobs: ", res['Message'])
else:
res = dirac.selectJobs(status=status,
minorStatus=minorStatus,
applicationStatus=appStatus,
site=site,
owner=owner,
date=date,
printErrors=False)
示例7: range
# 需要导入模块: from DIRAC.Interfaces.API.Dirac import Dirac [as 别名]
# 或者: from DIRAC.Interfaces.API.Dirac.Dirac import selectJobs [as 别名]
# ## ## ## ## ## ### ## ### ## ## ### ## ##
# ## ## ####### ## ## ## ## #### ## ## ######
# get jobs from today and yesterday...
days = []
for i in range(2): # how many days do you want to look back?
days.append((datetime.date.today() - datetime.timedelta(days=i)).isoformat())
# get list of run_tokens that are currently running / waiting
running_ids = set()
running_names = []
for status in ["Waiting", "Running", "Checking"]:
for day in days:
try:
[running_ids.add(id) for id in dirac.selectJobs(
status=status, date=day,
owner=username)['Value']]
except KeyError:
pass
n_jobs = len(running_ids)
if n_jobs > 0:
print("getting names from {} running/waiting jobs... please wait..."
.format(n_jobs))
for i, id in enumerate(running_ids):
if ((100 * i) / n_jobs) % 5 == 0:
print("\r{} %".format(((20 * i) / n_jobs) * 5)),
jobname = dirac.attributes(id)["Value"]["JobName"]
running_names.append(jobname)
else:
print("\n... done")
示例8: range
# 需要导入模块: from DIRAC.Interfaces.API.Dirac import Dirac [as 别名]
# 或者: from DIRAC.Interfaces.API.Dirac.Dirac import selectJobs [as 别名]
# ## ## ## ## ## ### ## ### ## ## ### ## ##
# ## ## ####### ## ## ## ## #### ## ## ######
# get jobs from today and yesterday...
days = []
for i in range(2): # how many days do you want to look back?
days.append((datetime.date.today() - datetime.timedelta(days=i)).isoformat())
# get list of run_tokens that are currently running / waiting
running_ids = set()
running_names = []
for status in ["Waiting", "Running", "Checking"]:
for day in days:
try:
[running_ids.add(id) for id in dirac.selectJobs(
status=status, date=day,
owner="tmichael")['Value']]
except KeyError:
pass
n_jobs = len(running_ids)
if n_jobs > 0:
print("getting names from {} running/waiting jobs... please wait..."
.format(n_jobs))
for i, id in enumerate(running_ids):
if ((100 * i) / n_jobs) % 5 == 0:
print("\r{} %".format(((20 * i) / n_jobs) * 5)),
jobname = dirac.attributes(id)["Value"]["JobName"]
running_names.append(jobname)
else:
print("\n... done")
示例9: Dirac
# 需要导入模块: from DIRAC.Interfaces.API.Dirac import Dirac [as 别名]
# 或者: from DIRAC.Interfaces.API.Dirac.Dirac import selectJobs [as 别名]
selDate = date
if not date:
selDate = 'Today'
conditions = { 'Status':status,
'MinorStatus':minorStatus,
'ApplicationStatus':appStatus,
'Owner':owner,
'JobGroup':jobGroup,
'Date':selDate }
from DIRAC.Interfaces.API.Dirac import Dirac
dirac = Dirac()
result = dirac.selectJobs( Status = status,
MinorStatus = minorStatus,
ApplicationStatus = appStatus,
Site = site,
Owner = owner,
JobGroup = jobGroup,
Date = date )
if not result['OK']:
print 'ERROR %s' % result['Message']
exitCode = 2
else:
conds = []
for n, v in conditions.items():
if v:
conds.append( '%s = %s' % ( n, v ) )
jobs = result['Value']
constrained = ' '
if len( jobs ) > 100:
jobs = jobs[:100]