refactor: adapt ResourceStatus/SiteStatus consumers to binary model - #8738
Conversation
a080078 to
873af57
Compare
|
Hi, this one LGTM. At the same time there are some failing tests in the backward compatibility: https://github.com/DIRACGrid/DIRAC/actions/runs/31604149176/job/94138661798?pr=8738#step:13:359 : and https://github.com/DIRACGrid/DIRAC/actions/runs/31604149176/job/94138661798?pr=8738#step:13:491 These are testing that a client of DIRAC version v9.0.X can talk with a server with version v9.1.X (this version). |
aldbr
left a comment
There was a problem hiding this comment.
There are other places that would need to be checked:
- The
if,elifblocks should likely disappear (we should not gate the writing part anymore):DIRAC/src/DIRAC/DataManagementSystem/scripts/dirac_admin_ban_se.py
Lines 116 to 125 in 36806a1
DIRAC/src/DIRAC/DataManagementSystem/scripts/dirac_admin_ban_se.py
Lines 135 to 144 in 36806a1
DIRAC/src/DIRAC/DataManagementSystem/scripts/dirac_admin_ban_se.py
Lines 155 to 165 in 36806a1
- Same here:
DIRAC/src/DIRAC/DataManagementSystem/scripts/dirac_admin_allow_se.py
Lines 125 to 136 in 36806a1
| if not (result := self.getSiteMask(status="Active"))["OK"]: | ||
| return result | ||
| siteMask = result["Value"] | ||
| if site in siteMask: | ||
| if printOutput: | ||
| gLogger.notice(f"Site {site} is already Active") | ||
| return S_OK(f"Site {site} is already Active") |
There was a problem hiding this comment.
This check should be removed I think.
A site in a Degraded status is seen as Active on the reading side and therefore if an admin wants to make it Active for whatever reason, it should likely not be prevented.
| if site in siteMask: | ||
| if printOutput: | ||
| gLogger.notice(f"Site {site} is already Banned") | ||
| return S_OK(f"Site {site} is already Banned") | ||
|
|
||
| tokenLifetime = int(days) | ||
| if tokenLifetime <= 0: | ||
| tokenExpiration = datetime.max |
There was a problem hiding this comment.
Same suggestion here, an admin might want to set Banned if the status is Probing
| if entry[1] in ALLOWED: | ||
| status = "Active" | ||
| else: | ||
| status = "Banned" |
There was a problem hiding this comment.
This piece of code appears twice (also in ResourceStatus) exactly the same way and could reused after in #8733.
I would extract it in a small utility function, in PolicySystem/StateMachine may be?
| status = "Active" | ||
| else: | ||
| status = "Banned" | ||
| res.update({(entry[0]): status}) |
There was a problem hiding this comment.
Isn't it the same as:
| res.update({(entry[0]): status}) | |
| res[entry[0]] = status |
|
|
||
| return cacheMatch | ||
|
|
||
| def getUsableSites(self, siteNames=None): |
There was a problem hiding this comment.
Just wondering: isn't it equivalent to getSites("Active") now?
What about just calling it inside getUsableSites?
| S_OK( { 'SE1': { 'ReadAccess': 'Probing' , | ||
| 'WriteAccess': 'Active', | ||
| 'CheckAccess': 'Degraded', | ||
| 'RemoveAccess': 'Banned'} } } ) |
There was a problem hiding this comment.
| S_OK( { 'SE1': { 'ReadAccess': 'Banned' , | |
| 'WriteAccess': 'Active', | |
| 'CheckAccess': 'Active', | |
| 'RemoveAccess': 'Banned'} } } ) |
873af57 to
c209b8a
Compare
closes #8686
BEGINRELEASENOTES
*ResourceStatusSystem
CHANGE: adapt ResourceStatus/SiteStatus consumers to binary model
ENDRELEASENOTES