Skip to content

Commit

Permalink
Merge pull request #7408 from fstagni/90_wms_fixes
Browse files Browse the repository at this point in the history
[9.0] TQDB fix: removed useless field
  • Loading branch information
fstagni authored Feb 7, 2024
2 parents 8a292b1 + 585e588 commit d9c424c
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ An example of requirements include the following::

JobRequirements =
[
OwnerDN = "/some/DN/";
Owner = "user_x";
VirtualOrganization = "VO";
Setup = "VO-Certification";
CPUTime = 17800;
Expand Down
5 changes: 2 additions & 3 deletions src/DIRAC/WorkloadManagementSystem/DB/TaskQueueDB.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
""" TaskQueueDB class is a front-end to the task queues db
"""
from collections import defaultdict
import random
import string
from collections import defaultdict
from typing import Any

from DIRAC import S_ERROR, S_OK, gConfig
Expand Down Expand Up @@ -97,7 +97,6 @@ def __initializeDB(self):
"Fields": {
"TQId": "INTEGER(11) UNSIGNED AUTO_INCREMENT NOT NULL",
"Owner": "VARCHAR(255) NOT NULL",
"OwnerDN": "VARCHAR(255)",
"OwnerGroup": "VARCHAR(32) NOT NULL",
"VO": "VARCHAR(32) NOT NULL",
"CPUTime": "BIGINT(20) UNSIGNED NOT NULL",
Expand Down Expand Up @@ -1151,7 +1150,7 @@ def __setPrioritiesForEntity(self, user, userGroup, share, connObj=False, consol
res = self._escapeString(user)
if not res["OK"]:
return res
userDN = res["Value"]
user = res["Value"]
tqCond.append(f"t.Owner= {user} ")
tqCond.append("t.TQId = j.TQId")
if consolidationFunc == "AVG":
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,6 @@ def export_submitJob(self, jobDesc):
:return: S_OK/S_ERROR, a list of newly created job IDs in case of S_OK.
"""

ownerDN = getDNForUsername(self.owner)["Value"][0]

if self.peerUsesLimitedProxy:
return S_ERROR(EWMSSUBM, "Can't submit using a limited proxy")

Expand Down Expand Up @@ -188,7 +186,6 @@ def export_submitJob(self, jobDesc):
JobDescriptionModel(
**baseJobDescritionModel.dict(exclude_none=True),
owner=self.owner,
ownerDN=ownerDN,
ownerGroup=self.ownerGroup,
vo=getVOForGroup(self.ownerGroup),
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -616,7 +616,7 @@ def __deleteSandboxFromExternalBackend(self, SEName, SEPFN):
result = self.sandboxDB.getSandboxOwner(SEName, SEPFN, hostDN, "hosts")
if not result["OK"]:
return result
owner, _ownerDN, ownerGroup = result["Value"]
owner, ownerGroup = result["Value"]

request = Request()
request.RequestName = f"RemoteSBDeletion:{SEName}|{SEPFN}:{time.time()}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,17 @@
* TQ 401
CPUTime: 360
Jobs: 3
OwnerDN: /O=GRID-FR/C=FR/O=CNRS/OU=CPPM/CN=Vanessa Hamar
OwnerGroup: dirac_user
Priority: 1.0
"""

import sys

from DIRAC import S_OK, gLogger
from DIRAC.Core.Utilities.PrettyPrint import printTable

from DIRAC.ConfigurationSystem.Client.Helpers.Registry import getUsernameForDN
from DIRAC.WorkloadManagementSystem.Client.MatcherClient import MatcherClient
from DIRAC.Core.Base.Script import Script
from DIRAC.Core.Utilities.PrettyPrint import printTable
from DIRAC.WorkloadManagementSystem.Client.MatcherClient import MatcherClient

verbose = False

Expand Down Expand Up @@ -74,16 +72,7 @@ def main():
record = [str(tqId)]
tqData = tqDict[tqId]
for key in fields[1:]:
if key == "Owner":
value = tqData.get("OwnerDN", "-")
if value != "-":
result = getUsernameForDN(value)
if not result["OK"]:
value = "Unknown"
else:
value = result["Value"]
else:
value = tqData.get(key, "-")
value = tqData.get(key, "-")
if isinstance(value, list):
if len(value) > 1:
record.append(str(value[0]) + "...")
Expand Down

0 comments on commit d9c424c

Please sign in to comment.