diff --git a/src/DIRAC/WorkloadManagementSystem/Agent/test/Test_Agent_SiteDirector.py b/src/DIRAC/WorkloadManagementSystem/Agent/test/Test_Agent_SiteDirector.py index d005cf3bd87..d44513fbcec 100644 --- a/src/DIRAC/WorkloadManagementSystem/Agent/test/Test_Agent_SiteDirector.py +++ b/src/DIRAC/WorkloadManagementSystem/Agent/test/Test_Agent_SiteDirector.py @@ -11,6 +11,7 @@ from DIRAC.ConfigurationSystem.Client import ConfigurationData from DIRAC.Core.Utilities.ProcessPool import S_OK from DIRAC.ResourceStatusSystem.Client.SiteStatus import SiteStatus +from DIRAC.ResourceStatusSystem.Client.ResourceStatus import ResourceStatus from DIRAC.WorkloadManagementSystem.Agent.SiteDirector import SiteDirector from DIRAC.WorkloadManagementSystem.Client import PilotStatus @@ -166,6 +167,9 @@ def sd(mocker, config): mocker.patch( "DIRAC.WorkloadManagementSystem.Agent.SiteDirector.SiteStatus.getUsableSites", return_values=usableSites ) + mocker.patch( + "DIRAC.WorkloadManagementSystem.Agent.SiteDirector.ResourceStatus.getElementStatus", return_values=usableSites + ) sd = SiteDirector() # Set logger @@ -180,6 +184,7 @@ def sd(mocker, config): # Set queueDict sd.siteClient = SiteStatus() + sd.rssClient = ResourceStatus() sd._buildQueueDict() return sd diff --git a/src/DIRAC/WorkloadManagementSystem/Service/WMSAdministratorHandler.py b/src/DIRAC/WorkloadManagementSystem/Service/WMSAdministratorHandler.py index f5640d846cd..f4dceaa0a95 100755 --- a/src/DIRAC/WorkloadManagementSystem/Service/WMSAdministratorHandler.py +++ b/src/DIRAC/WorkloadManagementSystem/Service/WMSAdministratorHandler.py @@ -35,7 +35,7 @@ def initializeHandler(cls, svcInfoDict): @deprecated("no-op RPC") def export_setSiteMask(self, siteList): """Set the site mask for matching. The mask is given in a form of Classad string. - + :param list siteList: site, status :return: S_OK()/S_ERROR() """ @@ -48,7 +48,7 @@ def export_setSiteMask(self, siteList): @deprecated("no-op RPC") def export_getSiteMask(cls, siteState="Active"): """Get the site mask - + :param str siteState: site status :return: S_OK(list)/S_ERROR() """ @@ -60,7 +60,7 @@ def export_getSiteMask(cls, siteState="Active"): @deprecated("no-op RPC") def export_getSiteMaskStatus(cls, sites=None): """Get the site mask of given site(s) with columns 'site' and 'status' only - + :param sites: list of sites or site :type sites: list or str :return: S_OK()/S_ERROR() -- S_OK contain dict or str @@ -74,7 +74,7 @@ def export_getSiteMaskStatus(cls, sites=None): @deprecated("no-op RPC") def export_getAllSiteMaskStatus(cls): """Get all the site parameters in the site mask - + :return: dict """ return S_OK() @@ -85,7 +85,7 @@ def export_getAllSiteMaskStatus(cls): @deprecated("no-op RPC") def export_banSite(self, site, comment="No comment"): """Ban the given site in the site mask - + :param str site: site :param str comment: comment :return: S_OK()/S_ERROR() @@ -98,7 +98,7 @@ def export_banSite(self, site, comment="No comment"): @deprecated("no-op RPC") def export_allowSite(self, site, comment="No comment"): """Allow the given site in the site mask - + :param str site: site :param str comment: comment :return: S_OK()/S_ERROR() @@ -112,7 +112,7 @@ def export_allowSite(self, site, comment="No comment"): @deprecated("no-op RPC") def export_clearMask(cls): """Clear up the entire site mask - + :return: S_OK()/S_ERROR() """ return S_OK() @@ -124,7 +124,7 @@ def export_clearMask(cls): @deprecated("no-op RPC") def export_getSiteMaskLogging(cls, sites): """Get the site mask logging history - + :param list sites: sites :return: S_OK(dict)/S_ERROR() """ @@ -137,7 +137,7 @@ def export_getSiteMaskLogging(cls, sites): @deprecated("no-op RPC") def export_getSiteMaskSummary(cls): """Get the mask status for all the configured sites - + :return: S_OK(dict)/S_ERROR() """ return S_OK() diff --git a/tests/Integration/ResourceStatusSystem/Test_SiteStatus.py b/tests/Integration/ResourceStatusSystem/Test_SiteStatus.py index 7f7fd07f586..85bf2a1df68 100644 --- a/tests/Integration/ResourceStatusSystem/Test_SiteStatus.py +++ b/tests/Integration/ResourceStatusSystem/Test_SiteStatus.py @@ -57,21 +57,18 @@ def test_addAndRemove_simpleCase(stClient): result = stClient.getSites() assert result["OK"] is True, result["Message"] - assert testSite in result["Value"] # TEST getSiteStatuses # ............................................................................... result = stClient.getSiteStatuses([testSite]) assert result["OK"] is True, result["Message"] - assert result["Value"][testSite] == "Active" # TEST getUsableSites # ............................................................................... result = stClient.getUsableSites([testSite]) assert result["OK"] is True, result["Message"] - assert testSite in result["Value"] # finally delete the test site result = rsClient.deleteStatusElement("Site", "Status", testSite) @@ -138,14 +135,12 @@ def test_addAndRemove_complicatedTest(stClient): result = stClient.getSites("All") assert result["OK"] is True, result["Message"] - # TEST getUsableSites # ............................................................................... result = stClient.getUsableSites() assert result["OK"] is True, result["Message"] - # setting a status result = stClient.setSiteStatus("testBanned.test.test", "Probing") assert result["OK"] is True, result["Message"]