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
22 changes: 11 additions & 11 deletions Interfaces/API/Dirac.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def __init__( self, withRepo = False, repoLocation = '', jobManagerClient = Fals
self.client = WMSClient( jobManagerClient, sbRPCClient, sbTransferClient, useCertificates )
self.pPrint = pprint.PrettyPrinter()
# Determine the default file catalog
defaultFC = gConfig.getValue( self.section + '/FileCatalog', '' )
defaultFC = gConfig.getValue( self.section + '/FileCatalog', [] )
if not defaultFC:
result = gConfig.getSections( 'Resources/FileCatalogs', listOrdered = True )
if result['OK']:
Expand Down Expand Up @@ -1018,17 +1018,17 @@ def runLocal( self, jobJDL, jobXML, baseDir, disableCopies = False, disableCallb
def __printOutput( self, fd = None, message = '' ):
"""Internal callback function to return standard output when running locally.
"""
if fd:
if type(fd) == types.IntType:
if fd:
if type( fd ) == types.IntType:
if fd == 0:
print >> sys.stdout, message
elif fd == 1:
print >> sys.stderr, message
else:
print message
elif type(fd) == types.FileType:
print >> fd, message
else:
elif type( fd ) == types.FileType:
print >> fd, message
else:
print message

#############################################################################
Expand Down Expand Up @@ -2813,11 +2813,11 @@ def __printInfo( self ):
self.log.info( '<=====%s=====>' % ( self.diracInfo ) )
self.log.verbose( self.cvsVersion )
self.log.verbose( 'DIRAC is running at %s in setup %s' % ( DIRAC.siteName(), self.setup ) )
def getConfigurationValue(self,option,default):

def getConfigurationValue( self, option, default ):
""" Export the configuration client getValue() function
"""
return gConfig.getValue(option,default)
"""

return gConfig.getValue( option, default )

#EOF#EOF#EOF#EOF#EOF#EOF#EOF#EOF#EOF#EOF#EOF#EOF#EOF#EOF#EOF#EOF#EOF#EOF#EOF
2 changes: 1 addition & 1 deletion Interfaces/scripts/dirac-admin-add-host.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def addProperty( arg ):
Script.gLogger.info( "Setting property %s to %s" % ( pName, pValue ) )
hostProps[ pName ] = pValue

if not diracAdmin.csModifyHost( hostName, hostProps, createIfNonExistant = True )['Value']:
if not diracAdmin.csModifyHost( hostName, hostProps, createIfNonExistant = True )['OK']:
errorList.append( ( "add host", "Cannot register host %s" % hostName ) )
exitCode = 255
else:
Expand Down
3 changes: 3 additions & 0 deletions Resources/Storage/StorageElement.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,9 @@ def dump( self ):
Dump to the logger a summary of the StorageElement items
"""
gLogger.info( "StorageElement.dump: Preparing dump for StorageElement %s." % self.name )
if not self.valid:
gLogger.error( "StorageElement.dump: Failed to create StorageElement plugins.", self.errorReason )
return
i = 1
outStr = "\n\n============ Options ============\n"
for key in sortList( self.options.keys() ):
Expand Down
47 changes: 29 additions & 18 deletions WorkloadManagementSystem/Agent/SiteDirector.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,18 +46,18 @@ def initialize( self ):
self.am_setOption( "PollingTime", 60.0 )
self.am_setOption( "maxPilotWaitingHours", 6 )
self.queueDict = {}

return S_OK()

def beginExecution( self ):

self.gridEnv = self.am_getOption( "GridEnv", getGridEnv() )
self.gridEnv = self.am_getOption( "GridEnv", getGridEnv() )
self.genericPilotDN = self.am_getOption( 'GenericPilotDN', 'Unknown' )
self.genericPilotGroup = self.am_getOption( 'GenericPilotGroup', 'Unknown' )
self.pilot = DIRAC_PILOT
self.install = DIRAC_INSTALL
self.workingDirectory = self.am_getOption( 'WorkDirectory' )
self.maxQueueLength = self.am_getOption( 'MaxQueueLength', 86400*3 )
self.maxQueueLength = self.am_getOption( 'MaxQueueLength', 86400 * 3 )

# Flags
self.updateStatus = self.am_getOption( 'UpdatePilotStatus', True )
Expand All @@ -73,7 +73,7 @@ def beginExecution( self ):
else:
siteNames = [siteName]
self.siteNames = siteNames

if self.updateStatus:
self.log.always( 'Pilot status update requested' )
if self.getOutput:
Expand Down Expand Up @@ -198,7 +198,7 @@ def execute( self ):
"""

if not self.queueDict:
self.log.warn('No site defined, exiting the cycle')
self.log.warn( 'No site defined, exiting the cycle' )
return S_OK()

result = self.submitJobs()
Expand Down Expand Up @@ -283,7 +283,13 @@ def submitJobs( self ):
self.log.info( 'Going to submit %d pilots to %s queue' % ( pilotsToSubmit, queue ) )

bundleProxy = self.queueDict[queue].get( 'BundleProxy', False )
result = self.__getExecutable( queue, pilotsToSubmit, bundleProxy )
jobExecDir = ''
if ceType == 'CREAM':
jobExecDir = '.'
jobExecDir = self.queueDict[queue].get( 'JobExecDir', jobExecDir )
httpProxy = self.queueDict[queue].get( 'BundleProxy', '' )

result = self.__getExecutable( queue, pilotsToSubmit, bundleProxy, httpProxy, jobExecDir )
if not result['OK']:
return result

Expand Down Expand Up @@ -338,7 +344,7 @@ def submitJobs( self ):
return S_OK()

#####################################################################################
def __getExecutable( self, queue, pilotsToSubmit, bundleProxy = True ):
def __getExecutable( self, queue, pilotsToSubmit, bundleProxy = True, httpProxy = '', jobExecDir = '' ):
""" Prepare the full executable for queue
"""

Expand All @@ -348,7 +354,7 @@ def __getExecutable( self, queue, pilotsToSubmit, bundleProxy = True ):
pilotOptions = self.__getPilotOptions( queue, pilotsToSubmit )
if pilotOptions is None:
return S_ERROR( 'Errors in compiling pilot options' )
executable = self.__writePilotScript( self.workingDirectory, pilotOptions, proxy )
executable = self.__writePilotScript( self.workingDirectory, pilotOptions, proxy, httpProxy, jobExecDir )
result = S_OK( executable )
return result

Expand All @@ -359,8 +365,8 @@ def __getPilotOptions( self, queue, pilotsToSubmit ):

queueDict = self.queueDict[queue]['ParametersDict']

vo = Registry.getVOForGroup(self.genericPilotGroup)
vo = Registry.getVOForGroup( self.genericPilotGroup )

if not vo:
self.log.error( 'Virtual Organization is not defined in the configuration' )
return None
Expand Down Expand Up @@ -426,7 +432,7 @@ def __getPilotOptions( self, queue, pilotsToSubmit ):
return pilotOptions

#####################################################################################
def __writePilotScript( self, workingDirectory, pilotOptions, proxy = '', httpProxy = '' ):
def __writePilotScript( self, workingDirectory, pilotOptions, proxy = '', httpProxy = '', pilotExecDir = '' ):
""" Bundle together and write out the pilot executable script, admixt the proxy if given
"""

Expand All @@ -447,7 +453,11 @@ def __writePilotScript( self, workingDirectory, pilotOptions, proxy = '', httpPr
#
import os, tempfile, sys, shutil, base64, bz2
try:
pilotWorkingDirectory = tempfile.mkdtemp( suffix = 'pilot', prefix= 'DIRAC_' )
pilotExecDir = '%(pilotExecDir)s'
if not pilotExecDir:
pilotExecDir = None
pilotWorkingDirectory = tempfile.mkdtemp( suffix = 'pilot', prefix = 'DIRAC_', dir = pilotExecDir )
pilotWorkingDirectory = os.path.realpath( pilotWorkingDirectory )
os.chdir( pilotWorkingDirectory )
if %(proxyFlag)s:
open( 'proxy', "w" ).write(bz2.decompress( base64.decodestring( "%(compressedAndEncodedProxy)s" ) ) )
Expand Down Expand Up @@ -479,11 +489,12 @@ def __writePilotScript( self, workingDirectory, pilotOptions, proxy = '', httpPr
shutil.rmtree( pilotWorkingDirectory )

EOF
""" % { 'compressedAndEncodedProxy': compressedAndEncodedProxy, \
'compressedAndEncodedPilot': compressedAndEncodedPilot, \
'compressedAndEncodedInstall': compressedAndEncodedInstall, \
'httpProxy': httpProxy, \
'pilotScript': os.path.basename( self.pilot ), \
""" % { 'compressedAndEncodedProxy': compressedAndEncodedProxy,
'compressedAndEncodedPilot': compressedAndEncodedPilot,
'compressedAndEncodedInstall': compressedAndEncodedInstall,
'httpProxy': httpProxy,
'pilotExecDir': pilotExecDir,
'pilotScript': os.path.basename( self.pilot ),
'installScript': os.path.basename( self.install ),
'pilotOptions': ' '.join( pilotOptions ),
'proxyFlag': proxyFlag }
Expand Down