Exemplo n.º 1
0
    sql = "SELECT PandaID,lockedby FROM ATLAS_PANDA.jobsActive4 "
sql += "WHERE jobStatus=:jobStatus AND computingSite=:computingSite AND modificationTime<:modificationTime AND prodSourceLabel=:prodSourceLabel ORDER BY PandaID"
status,res = proxyS.querySQLS(sql,varMap)

print "got {0} jobs".format(len(res))

jobs = []
jediJobs = []
if res != None:
    for (id,lockedby) in res:
        if lockedby == 'jedi':
            jediJobs.append(id)
        else:
            jobs.append(id)
if len(jobs):
    nJob = 100
    iJob = 0
    while iJob < len(jobs):
        print 'reassign  %s' % str(jobs[iJob:iJob+nJob])
        Client.reassignJobs(jobs[iJob:iJob+nJob])
        iJob += nJob
if len(jediJobs) != 0:
    nJob = 100
    iJob = 0
    while iJob < len(jediJobs):
        print 'kill JEDI jobs %s' % str(jediJobs[iJob:iJob+nJob])
        Client.killJobs(jediJobs[iJob:iJob+nJob],51)
        iJob += nJob


Exemplo n.º 2
0
status, res = proxyS.querySQLS(sql, varMap)
if res != None:
    for (id, lockedby) in res:
        if lockedby == 'jedi':
            jediJobs.append(id)
        else:
            jobs.append(id)

# reassign
jobs.sort()
if len(jobs):
    nJob = 100
    iJob = 0
    while iJob < len(jobs):
        print 'reassign  %s' % str(jobs[iJob:iJob + nJob])
        Client.reassignJobs(jobs[iJob:iJob + nJob])
        iJob += nJob
        time.sleep(10)

if len(jediJobs) != 0:
    nJob = 100
    iJob = 0
    while iJob < len(jediJobs):
        print 'kill JEDI jobs %s' % str(jediJobs[iJob:iJob + nJob])
        Client.killJobs(jediJobs[iJob:iJob + nJob],
                        codeV,
                        keepUnmerged=options.keepUnmerged)
        iJob += nJob

print
print 'reassigned {0} jobs'.format(len(jobs + jediJobs))
Exemplo n.º 3
0
import sys

import userinterface.Client as Client

if len(sys.argv) == 2:
    Client.reassignJobs([sys.argv[1]])
else:
    startID = int(sys.argv[1])
    endID   = int(sys.argv[2])
    if startID > endID:
        print '%d is less than %d' % (endID,startID)
        sys.exit(1)
    Client.reassignJobs(range(startID,endID+1))

allSites = []
for site in tmpSites:
    # _allSites may conain NULL after sort()
    if site == 'NULL':
        continue
    # ignore test sites
    if site.endswith('test') or site.endswith('Test'):
        continue
    # append
    allSites.append(site)

# reassign jobs
jobs=[]
for (id,modTime) in res:
    if modTime < timeLimit:
        jobs.append(id)

# reassign
if len(jobs):
    nJob = 20
    iJob = 0
    while iJob < len(jobs):
        print 'reassignJobs(%s)' % jobs[iJob:iJob+nJob]
        index = random.randint(1,len(allSites))
        site = allSites[int(index)-1]
        print 'site=%s' % site
        Client.reassignJobs(jobs[iJob:iJob+nJob],site)
        iJob += nJob
        time.sleep(10)