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
16 changes: 9 additions & 7 deletions Core/scripts/dirac-install.py
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ def __loadCFGFromURL( self, urlcfg, checkHash = False ):
if urlcfg in self.__cfgCache:
return S_OK( self.__cfgCache[ urlcfg ] )
try:
cfgFile = urllib2.urlopen( urlcfg )
cfgFile = urllib2.urlopen( urlcfg, timeout = 60 )
except:
return S_ERROR( "Could not open %s" % urlcfg )
try:
Expand All @@ -315,7 +315,7 @@ def __loadCFGFromURL( self, urlcfg, checkHash = False ):
self.__cfgCache[ urlcfg ] = cfg
return S_OK( cfg )
try:
md5File = urllib2.urlopen( urlcfg[:-4] + ".md5" )
md5File = urllib2.urlopen( urlcfg[:-4] + ".md5", timeout = 60 )
md5Hex = md5File.read().strip()
md5File.close()
if md5Hex != md5.md5( cfgData ).hexdigest():
Expand Down Expand Up @@ -770,15 +770,15 @@ def urlretrieveTimeout( url, fileName, timeout = 0 ):
if timeout:
signal.signal( signal.SIGALRM, alarmTimeoutHandler )
# set timeout alarm
signal.alarm( timeout )
signal.alarm( timeout + 5 )
try:
# if "http_proxy" in os.environ and os.environ['http_proxy']:
# proxyIP = os.environ['http_proxy']
# proxy = urllib2.ProxyHandler( {'http': proxyIP} )
# opener = urllib2.build_opener( proxy )
# #opener = urllib2.build_opener()
# urllib2.install_opener( opener )
remoteFD = urllib2.urlopen( url )
remoteFD = urllib2.urlopen( url, timeout = timeout )
expectedBytes = long( remoteFD.info()[ 'Content-Length' ] )
localFD = open( fileName, "wb" )
receivedBytes = 0L
Expand All @@ -805,6 +805,8 @@ def urlretrieveTimeout( url, fileName, timeout = 0 ):
if x.code == 404:
logERROR( "%s does not exist" % url )
return False
except urllib2.URLError:
logError( 'Timeout after %s seconds on transfer request for "%s"' % ( str( timeout ), url ) )
except Exception, x:
if x == 'Timeout':
logERROR( 'Timeout after %s seconds on transfer request for "%s"' % ( str( timeout ), url ) )
Expand Down Expand Up @@ -1219,7 +1221,7 @@ def createPermanentDirLinks():
except Exception, x:
logERROR( str( x ) )
return False

return True

def createBashrc():
Expand Down Expand Up @@ -1276,7 +1278,7 @@ def createBashrc():
def createCshrc():
""" Create DIRAC environment setting script for the (t)csh shell
"""

proPath = cliParams.targetPath
# Now create cshrc at basePath
try:
Expand Down Expand Up @@ -1379,7 +1381,7 @@ def writeDefaultConfiguration():
if not createBashrc():
sys.exit( 1 )
if not createCshrc():
sys.exit( 1 )
sys.exit( 1 )
runExternalsPostInstall()
writeDefaultConfiguration()
installExternalRequirements( cliParams.externalsType )
Expand Down
2 changes: 1 addition & 1 deletion Interfaces/scripts/dirac-admin-add-user.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def addUserGroup( arg ):
Script.gLogger.info( "Setting property %s to %s" % ( pName, pValue ) )
userProps[ pName ] = pValue

if not diracAdmin.csModifyUser( userName, userProps, createIfNonExistant = True )['Value']:
if not diracAdmin.csModifyUser( userName, userProps, createIfNonExistant = True )['OK']:
errorList.append( ( "add user", "Cannot register user %s" % userName ) )
exitCode = 255
else:
Expand Down
20 changes: 19 additions & 1 deletion WorkloadManagementSystem/Agent/StalledJobAgent.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
from DIRAC import S_OK, S_ERROR, gConfig
from DIRAC.Core.DISET.RPCClient import RPCClient
from DIRAC.AccountingSystem.Client.Types.Job import Job
from DIRAC.Core.Utilities.ClassAd.ClassAdLight import ClassAd
from DIRAC.ConfigurationSystem.Client.Helpers import cfgPath
from DIRAC.ConfigurationSystem.Client.PathFinder import getSystemInstance
import types
Expand All @@ -30,6 +31,8 @@ class StalledJobAgent( AgentModule ):
- finalize() - the graceful exit of the method, this one is usually used
for the agent restart
"""
jobDB = None
logDB = None

jobDB = None
logDB = None
Expand Down Expand Up @@ -272,6 +275,19 @@ def __updateJobStatus( self, job, status, minorstatus = None ):

return result

def __getProcessingType( self, jobID ):
""" Get the Processing Type from the JDL, until it is promoted to a real Attribute
"""
processingType = 'unknown'
result = self.jobDB.getJobJDL( jobID, original = True )
if not result['OK']:
return processingType
classAdJob = ClassAd( result['Value'] )
if classAdJob.lookupAttribute( 'ProcessingType' ):
processingType = classAdJob.getAttributeString( 'ProcessingType' )
return processingType


#############################################################################
def __sendAccounting( self, jobID ):
""" Send WMS accounting data for the given job
Expand All @@ -297,6 +313,8 @@ def __sendAccounting( self, jobID ):
else:
cpuNormalization = cpuNormalization['Value']

processingType = self.__getProcessingType( jobID )

accountingReport.setStartTime( startTime )
accountingReport.setEndTime( endTime )
# execTime = toEpoch( endTime ) - toEpoch( startTime )
Expand All @@ -307,7 +325,7 @@ def __sendAccounting( self, jobID ):
'JobGroup' : jobDict['JobGroup'],
'JobType' : jobDict['JobType'],
'JobClass' : jobDict['JobSplitType'],
'ProcessingType' : 'unknown',
'ProcessingType' : processingType,
'FinalMajorStatus' : 'Failed',
'FinalMinorStatus' : 'Stalled',
'CPUTime' : lastCPUTime,
Expand Down