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
2 changes: 1 addition & 1 deletion environment-py3.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ channels:

dependencies:
# Temporary workarounds
- astroid !=2.5 # https://github.com/PyCQA/astroid/issues/903
- astroid 2.5.6 # https://github.com/PyCQA/astroid/issues/1006 and https://github.com/PyCQA/astroid/issues/1007
# runtime
- python =3.9
- pip
Expand Down
80 changes: 53 additions & 27 deletions src/DIRAC/FrameworkSystem/Client/SystemAdministratorClientCLI.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from __future__ import print_function
from __future__ import absolute_import
from __future__ import division

import sys
import pprint
import os
Expand Down Expand Up @@ -504,18 +505,31 @@ def getInstallations(self, argss):
installations = result['Value']

if installations:
if display == 'table':
gLogger.notice('')
gLogger.notice(' ' + 'Num'.center(5) + ' ' +
'Host'.center(20) + ' ' +
'Name'.center(20) + ' ' +
'Module'.center(20) + ' ' +
'System'.center(16) + ' ' +
'Type'.center(12) + ' ' +
'Installed on'.center(18) + ' ' +
'Install by'.center(12) + ' ' +
'Uninstalled on'.center(18) + ' ' +
'Uninstall by'.center(12))
if display == "table":
gLogger.notice("")
gLogger.notice(
" "
+ "Num".center(5)
+ " "
+ "Host".center(20)
+ " "
+ "Name".center(20)
+ " "
+ "Module".center(20)
+ " "
+ "System".center(16)
+ " "
+ "Type".center(12)
+ " "
+ "Installed on".center(18)
+ " "
+ "Install by".center(12)
+ " "
+ "Uninstalled on".center(18)
+ " "
+ "Uninstall by".center(12)
)
gLogger.notice(("-") * 164)
gLogger.notice(('-') * 164)
for i, installation in enumerate(installations):
if not installation['InstalledBy']:
Expand All @@ -535,26 +549,39 @@ def getInstallations(self, argss):
uninstalledOn = ''
isInstalled = 'Yes'

if display == 'table':
gLogger.notice('|' + str(i + 1).center(5) + '|' +
installation['Host']['HostName'].center(20) + '|' +
installation['Instance'].center(20) + '|' +
installation['Component']['Module'].center(20) + '|' +
installation['Component']['System'].center(16) + '|' +
installation['Component']['Type'].center(12) + '|' +
installation['InstallationTime'].strftime("%d-%m-%Y %H:%M").center(18) + '|' +
installedBy.center(12) + '|' +
uninstalledOn.center(18) + '|' +
uninstalledBy.center(12) + '|')
gLogger.notice(('-') * 164)
if display == "table":
gLogger.notice(
"|"
+ str(i + 1).center(5)
+ "|"
+ installation["Host"]["HostName"].center(20)
+ "|"
+ installation["Instance"].center(20)
+ "|"
+ installation["Component"]["Module"].center(20)
+ "|"
+ installation["Component"]["System"].center(16)
+ "|"
+ installation["Component"]["Type"].center(12)
+ "|"
+ installation["InstallationTime"].strftime("%d-%m-%Y %H:%M").center(18)
+ "|"
+ installedBy.center(12)
+ "|"
+ uninstalledOn.center(18)
+ "|"
+ uninstalledBy.center(12)
+ "|"
)
gLogger.notice(("-") * 164)
elif display == 'list':
gLogger.notice('')
gLogger.notice('Installation: '.rjust(20) + str(i + 1))
gLogger.notice('Installed: '.rjust(20) + isInstalled)
gLogger.notice('Host: '.rjust(20) + installation['Host']['HostName'])
gLogger.notice('Name: '.rjust(20) + installation['Instance'])
gLogger.notice('Module: '.rjust(20) + installation['Component']['Module'])
gLogger.notice('System: '.rjust(20) + installation['Component']['System'])
gLogger.notice('Module: '.rjust(20) + installation['Component']['DIRACModule'])
gLogger.notice('System: '.rjust(20) + installation['Component']['DIRACSystem'])
gLogger.notice('Type: '.rjust(20) + installation['Component']['Type'])
gLogger.notice('Installed on: '.rjust(20) + installation['InstallationTime'].strftime("%d-%m-%Y %H:%M"))
if installedBy != '':
Expand Down Expand Up @@ -794,7 +821,6 @@ def do_uninstall(self, args):
result = getProxyInfo()
if not result['OK']:
self._errMsg(result['Message'])
user = result['Value']['username']

option = argss[0]
if option == 'db':
Expand Down
4 changes: 2 additions & 2 deletions src/DIRAC/Interfaces/API/Dirac.py
Original file line number Diff line number Diff line change
Expand Up @@ -614,7 +614,7 @@ def runLocal(self, job):
self.log.warn('Input data resolution failed')
return result

softwarePolicy = self.__getVOPolicyModule('SoftwareDistModule')
softwarePolicy = Operations().getValue('SoftwareDistModule')
if softwarePolicy:
moduleFactory = ModuleFactory()
moduleInstance = moduleFactory.getModule(softwarePolicy, {'Job': parameters})
Expand All @@ -628,7 +628,7 @@ def runLocal(self, job):
self.log.warn('Software installation failed with result:\n%s' % (result))
return result
else:
self.log.verbose('Could not retrieve DIRAC/VOPolicy/SoftwareDistModule for VO')
self.log.verbose('Could not retrieve SoftwareDistModule for VO')

self.log.debug("Looking for resolving the input sandbox, if it is present")
sandbox = parameters.get('InputSandbox')
Expand Down
4 changes: 2 additions & 2 deletions src/DIRAC/WorkloadManagementSystem/Agent/JobAgent.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

from diraccfg import CFG

from DIRAC import S_OK, S_ERROR, gConfig, rootPath
from DIRAC import S_OK, S_ERROR, gConfig, rootPath, siteName
from DIRAC.Core.Utilities.ModuleFactory import ModuleFactory
from DIRAC.Core.Utilities.ClassAd.ClassAdLight import ClassAd
from DIRAC.Core.Base.AgentModule import AgentModule
Expand Down Expand Up @@ -116,7 +116,7 @@ def initialize(self):

self.initTimes = os.times()
# Localsite options
self.siteName = gConfig.getValue('/LocalSite/Site', self.siteName)
self.siteName = siteName()
self.pilotReference = gConfig.getValue('/LocalSite/PilotReference', self.pilotReference)
self.defaultProxyLength = gConfig.getValue('/Registry/DefaultProxyLifeTime', self.defaultProxyLength)
# Agent options
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import os
from six.moves.urllib.request import urlopen

import DIRAC
from DIRAC import gConfig, gLogger, S_OK, S_ERROR
from DIRAC.ConfigurationSystem.Client.Helpers.Resources import getCESiteMapping
from DIRAC.Resources.Computing.BatchSystems.TimeLeft.TimeLeft import TimeLeft
Expand Down Expand Up @@ -218,7 +219,7 @@ def getCPUTime(cpuNormalizationFactor):
# we have to look for a ceQueue in the CS
# A bit hacky. We should better profit from something generic
gLogger.warn("No CEQueue in local configuration, looking to find one in CS")
siteName = gConfig.getValue('/LocalSite/Site')
siteName = DIRAC.siteName()
queueSection = '/Resources/Sites/%s/%s/CEs/%s/Queues' % (siteName.split('.')[0], siteName, gridCE)
res = gConfig.getSections(queueSection)
if not res['OK']:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def __init__(self, jobID=None, jobReport=None):
self.jobID = 0
else:
self.jobID = jobID
self.siteName = gConfig.getValue('/LocalSite/Site', 'Unknown')
self.siteName = DIRAC.siteName()
if jobReport:
self.jobReport = jobReport
else:
Expand Down
12 changes: 3 additions & 9 deletions tests/Integration/Framework/Test_InstalledComponentsDB.py
Original file line number Diff line number Diff line change
Expand Up @@ -379,32 +379,26 @@ def testHostLogging(self):

# Create a sample log
result = self.client.updateLog('TestHost', {'DIRACVersion': 'v6r15'})

self.assertTrue(result['OK'])

# Check that the log exists
result = self.client.getLog('TestHost')

self.assertTrue(result['OK'] and result['Value'][0]['DIRACVersion'] == 'v6r15')

# Update the fields of the created log
result = self.client.updateLog('TestHost', {'hostName': 'StillATestHost'})

self.assertTrue(result['OK'])

# Check if the log with the modified fields exists
result = self.client.getLog('StillATestHost')

self.assertTrue(result['OK'] and result['Value'][0]['DIRACVersion'] == 'v6r15')

# Remove the log
result = self.client.removeLogs({'hostName': 'StillATestHost'})

self.assertTrue(result['OK'])

# Check that the log was actually removed
result = self.client.getLog('StillATestHost')

self.assertFalse(result['OK'])

# Multiple removal
Expand All @@ -415,15 +409,15 @@ def testHostLogging(self):
self.client.removeLogs({'DIRACVersion': 'v7r0'})

result = self.client.getLog('TestHostC')

self.assertTrue(result['OK'] and len(result['Value']) >= 1)

result = self.client.getLog('TestHostB')

self.assertFalse(result['OK'])

result = self.client.removeLogs({'DIRACVersion': 'v7r1'})
result = self.client.getLogs()
self.assertTrue(result['OK'])

result = self.client.removeLogs({'DIRACVersion': 'v7r1'})
self.assertTrue(result['OK'])


Expand Down
16 changes: 5 additions & 11 deletions tests/Jenkins/dirac-cfg-update.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,17 +66,11 @@
setup = gConfig.getValue('/DIRAC/Setup')
if not setup:
setup = 'dirac-JenkinsSetup'
if not vo:
vo = gConfig.getValue('/DIRAC/VirtualOrganization')
if not vo:
vo = 'dirac'

if not localCfg.isSection('/DIRAC/VOPolicy'):
localCfg.createNewSection('/DIRAC/VOPolicy')
if not localCfg.isSection('/DIRAC/VOPolicy/%s' % vo):
localCfg.createNewSection('/DIRAC/VOPolicy/%s' % vo)
if not localCfg.isSection('/DIRAC/VOPolicy/%s/%s' % (vo, setup)):
localCfg.createNewSection('/DIRAC/VOPolicy/%s/%s' % (vo, setup))
localCfg.setOption('/DIRAC/VOPolicy/%s/%s/SoftwareDistModule' % (vo, setup), '')
if not localCfg.isSection('/Operations'):
localCfg.createNewSection('/Operations')
if not localCfg.isSection('/Operations/%s' % setup):
localCfg.createNewSection('/Operations/%s' % setup)
localCfg.setOption('/Operations/%s/SoftwareDistModule' % setup, '')

localCfg.writeToFile(localConfigFile)