Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion Core/Utilities/MySQL.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@

from DIRAC import gLogger
from DIRAC import S_OK, S_ERROR
from DIRAC import Time

import MySQLdb
# This is for proper initialization of embeded server, it should only be called once
Expand Down Expand Up @@ -376,7 +377,11 @@ def _escapeValues( self, inValues = None ):
return retDict
inEscapeValues.append( retDict['Value'] )
else:
inEscapeValues.append( str( value ) )
retDict = self.__escapeString( str( value ), connection )
if not retDict['OK']:
self.__putConnection( connection )
return retDict
inEscapeValues.append( retDict['Value'] )
self.__putConnection( connection )
return S_OK( inEscapeValues )

Expand Down
4 changes: 2 additions & 2 deletions RequestManagementSystem/DB/RequestDBMySQL.py
Original file line number Diff line number Diff line change
Expand Up @@ -295,8 +295,8 @@ def getRequest( self, requestType ):
req = "SELECT * from SubRequests WHERE Status IN ( 'Waiting', 'Assigned' ) ORDER BY ExecutionOrder, LastUpdate"
# now get sorted list of RequestID (according to the above)
req = "SELECT * from ( %s ) as T1 GROUP BY RequestID" % req
# and get the 10 oldest ones of Type requestType
req = "SELECT RequestID, ExecutionOrder FROM ( %s ) as T2 WHERE RequestType = %s ORDER BY LastUpdate limit 10" % ( req, myRequestType )
# and get the 100 oldest ones of Type requestType
req = "SELECT RequestID, ExecutionOrder FROM ( %s ) as T2 WHERE RequestType = %s ORDER BY LastUpdate limit 100" % ( req, myRequestType )
# and now get all waiting SubRequest for the selected RequestID and ExecutionOrder
req = "SELECT A.%s FROM SubRequests AS A, ( %s ) AS B WHERE " % ( ', A.'.join( fields ), req )
req = "%s A.RequestID = B.RequestID AND A.ExecutionOrder = B.ExecutionOrder AND A.Status = 'Waiting' AND A.RequestType = %s;" % ( req, myRequestType )
Expand Down
46 changes: 26 additions & 20 deletions WorkloadManagementSystem/DB/JobDB.py
Original file line number Diff line number Diff line change
Expand Up @@ -1332,10 +1332,10 @@ def insertNewJobIntoDB( self, jdl, owner, ownerDN, ownerGroup, diracSetup ):
classAdJob.insertAttributeInt( 'JobRequirements', reqJDL )

jobJDL = classAdJob.asJDL()

# Replace the JobID placeholder if any
if jobJDL.find('%j') != -1:
jobJDL = jobJDL.replace('%j',str(jobID))
if jobJDL.find( '%j' ) != -1:
jobJDL = jobJDL.replace( '%j', str( jobID ) )

result = self.setJobJDL( jobID, jobJDL )
if not result['OK']:
Expand Down Expand Up @@ -1415,7 +1415,7 @@ def __checkAndPrepareJob( self, jobID, classAdJob, classAdReq, owner, ownerDN,
classAdJob.insertAttributeString( 'OwnerGroup', ownerGroup )
if vo:
classAdJob.insertAttributeString( 'VirtualOrganization', vo )
submitPool = getVOOption(vo,'SubmitPools')
submitPool = getVOOption( vo, 'SubmitPools' )
if submitPool and not classAdJob.lookupAttribute( 'SubmitPools' ):
classAdJob.insertAttributeString( 'SubmitPools', submitPool )

Expand Down Expand Up @@ -1666,8 +1666,8 @@ def rescheduleJob ( self, jobID ):
site = classAdJob.getAttributeString( 'Site' )
if not site:
site = 'ANY'
elif site.find(',') > 0:
site = "Multiple"
elif site.find( ',' ) > 0:
site = "Multiple"
jobAttrNames.append( 'Site' )
jobAttrValues.append( site )

Expand Down Expand Up @@ -2008,20 +2008,26 @@ def getSiteSummaryWeb( self, selectDict, sortList, startItem, maxItems ):

# Sort out different counters
resultDict = {}
for attDict, count in result['Value']:
siteFullName = attDict['Site']
status = attDict['Status']
if not resultDict.has_key( siteFullName ):
resultDict[siteFullName] = {}
for state in JOB_STATES:
resultDict[siteFullName][state] = 0
if status not in JOB_FINAL_STATES:
resultDict[siteFullName][status] = count
for attDict, count in resultDay['Value']:
siteFullName = attDict['Site']
status = attDict['Status']
if status in JOB_FINAL_STATES:
resultDict[siteFullName][status] = count
if result['OK']:
for attDict, count in result['Value']:
siteFullName = attDict['Site']
status = attDict['Status']
if not resultDict.has_key( siteFullName ):
resultDict[siteFullName] = {}
for state in JOB_STATES:
resultDict[siteFullName][state] = 0
if status not in JOB_FINAL_STATES:
resultDict[siteFullName][status] = count
if resultDay['OK']:
for attDict, count in resultDay['Value']:
siteFullName = attDict['Site']
if not resultDict.has_key( siteFullName ):
resultDict[siteFullName] = {}
for state in JOB_STATES:
resultDict[siteFullName][state] = 0
status = attDict['Status']
if status in JOB_FINAL_STATES:
resultDict[siteFullName][status] = count

# Collect records now
records = []
Expand Down