From 649274a7a2b71ede1668930b100852464ce8d68e Mon Sep 17 00:00:00 2001 From: Federico Stagni Date: Wed, 26 Jul 2023 10:51:20 +0200 Subject: [PATCH] feat: store in TransformationDB the Author alongside the AuthorDN --- .../Agent/TaskManagerAgentBase.py | 8 ++- .../Agent/TransformationCleaningAgent.py | 20 +++---- .../test/Test_Agent_TransformationSystem.py | 5 +- .../Client/RequestTasks.py | 1 - .../Client/Transformation.py | 53 ++----------------- .../Client/TransformationCLI.py | 41 ++------------ .../DB/TransformationDB.py | 28 +++++----- .../DB/TransformationDB.sql | 3 +- .../Service/TransformationManagerHandler.py | 47 +++++++--------- .../Utilities/TransformationInfo.py | 4 +- .../dirac_transformation_information.py | 8 +-- .../TransformationSystem/test/Test_DRA.py | 14 ++--- .../TransformationSystem/test/Test_JobInfo.py | 16 +++--- .../test/Test_TransformationInfo.py | 2 +- 14 files changed, 80 insertions(+), 170 deletions(-) diff --git a/src/DIRAC/TransformationSystem/Agent/TaskManagerAgentBase.py b/src/DIRAC/TransformationSystem/Agent/TaskManagerAgentBase.py index b3a8cff3a07..628d0ab4d31 100644 --- a/src/DIRAC/TransformationSystem/Agent/TaskManagerAgentBase.py +++ b/src/DIRAC/TransformationSystem/Agent/TaskManagerAgentBase.py @@ -50,7 +50,7 @@ def __init__(self, *args, **kwargs): # credentials self.shifterProxy = None self.credentials = None - self.credTuple = (None, None, None) + self.credTuple = (None, None) self.pluginLocation = "" self.bulkSubmissionFlag = False @@ -101,17 +101,16 @@ def execute(self): """The execution method is transformations that need to be processed""" # 1. determining which credentials will be used for the submission - owner, ownerGroup, ownerDN = None, None, None + owner, ownerGroup = None, None # getting the credentials for submission resProxy = getProxyInfo(proxy=False, disableVOMS=False) if resProxy["OK"]: # there is a shifterProxy proxyInfo = resProxy["Value"] owner = proxyInfo["username"] ownerGroup = proxyInfo["group"] - ownerDN = proxyInfo["identity"] self.log.info(f"ShifterProxy: Tasks will be submitted with the credentials {owner}:{ownerGroup}") elif self.credentials: - owner, ownerGroup, ownerDN = self.credTuple + owner, ownerGroup = self.credTuple else: self.log.info("Using per Transformation Credentials!") @@ -137,7 +136,6 @@ def execute(self): transformations, owner=owner, ownerGroup=ownerGroup, - ownerDN=ownerDN, ) # 2.2. Determine whether the task files status is to be monitored and updated diff --git a/src/DIRAC/TransformationSystem/Agent/TransformationCleaningAgent.py b/src/DIRAC/TransformationSystem/Agent/TransformationCleaningAgent.py index 85d8569fd4d..17e65cf1251 100644 --- a/src/DIRAC/TransformationSystem/Agent/TransformationCleaningAgent.py +++ b/src/DIRAC/TransformationSystem/Agent/TransformationCleaningAgent.py @@ -148,10 +148,10 @@ def execute(self): self._executeClean(transDict) else: self.log.info( - f"Cleaning transformation {transDict['TransformationID']} with {transDict['AuthorDN']}, {transDict['AuthorGroup']}" + f"Cleaning transformation {transDict['TransformationID']} with {transDict['Author']}, {transDict['AuthorGroup']}" ) executeWithUserProxy(self._executeClean)( - transDict, proxyUserDN=transDict["AuthorDN"], proxyUserGroup=transDict["AuthorGroup"] + transDict, proxyUserName=transDict["Author"], proxyUserGroup=transDict["AuthorGroup"] ) else: self.log.error("Failed to get transformations", res["Message"]) @@ -164,11 +164,11 @@ def execute(self): self._executeRemoval(transDict) else: self.log.info( - "Removing files for transformation %(TransformationID)s with %(AuthorDN)s, %(AuthorGroup)s" + "Removing files for transformation %(TransformationID)s with %(Author)s, %(AuthorGroup)s" % transDict ) executeWithUserProxy(self._executeRemoval)( - transDict, proxyUserDN=transDict["AuthorDN"], proxyUserGroup=transDict["AuthorGroup"] + transDict, proxyUserName=transDict["Author"], proxyUserGroup=transDict["AuthorGroup"] ) else: self.log.error("Could not get the transformations", res["Message"]) @@ -186,11 +186,11 @@ def execute(self): self._executeArchive(transDict) else: self.log.info( - "Archiving files for transformation %(TransformationID)s with %(AuthorDN)s, %(AuthorGroup)s" + "Archiving files for transformation %(TransformationID)s with %(Author)s, %(AuthorGroup)s" % transDict ) executeWithUserProxy(self._executeArchive)( - transDict, proxyUserDN=transDict["AuthorDN"], proxyUserGroup=transDict["AuthorGroup"] + transDict, proxyUserName=transDict["Author"], proxyUserGroup=transDict["AuthorGroup"] ) else: self.log.error("Could not get the transformations", res["Message"]) @@ -244,10 +244,10 @@ def finalize(self): self._executeClean(transDict) else: self.log.info( - f"Cleaning transformation {transDict['TransformationID']} with {transDict['AuthorDN']}, {transDict['AuthorGroup']}" + f"Cleaning transformation {transDict['TransformationID']} with {transDict['Author']}, {transDict['AuthorGroup']}" ) executeWithUserProxy(self._executeClean)( - transDict, proxyUserDN=transDict["AuthorDN"], proxyUserGroup=transDict["AuthorGroup"] + transDict, proxyUserName=transDict["Author"], proxyUserGroup=transDict["AuthorGroup"] ) for transDict in toArchive: @@ -255,11 +255,11 @@ def finalize(self): self._executeArchive(transDict) else: self.log.info( - "Archiving files for transformation %(TransformationID)s with %(AuthorDN)s, %(AuthorGroup)s" + "Archiving files for transformation %(TransformationID)s with %(Author)s, %(AuthorGroup)s" % transDict ) executeWithUserProxy(self._executeArchive)( - transDict, proxyUserDN=transDict["AuthorDN"], proxyUserGroup=transDict["AuthorGroup"] + transDict, proxyUser=transDict["Author"], proxyUserGroup=transDict["AuthorGroup"] ) # Remove JobIDs that were unknown to the TransformationSystem diff --git a/src/DIRAC/TransformationSystem/Agent/test/Test_Agent_TransformationSystem.py b/src/DIRAC/TransformationSystem/Agent/test/Test_Agent_TransformationSystem.py index 2c15669812e..ae8b2e13fbd 100644 --- a/src/DIRAC/TransformationSystem/Agent/test/Test_Agent_TransformationSystem.py +++ b/src/DIRAC/TransformationSystem/Agent/test/Test_Agent_TransformationSystem.py @@ -148,9 +148,8 @@ def test_checkReservedTasks( "TransformationID": 1, "Operations": ["op1", "op2"], "Body": "veryBigBody", - "Owner": "prodMan", - "OwnerDN": "/ca=man/user=prodMan", - "OwnerGroup": "prodMans", + "Owner": "prod", + "OwnerGroup": "prods", } sOkJobDict = {"OK": True, "Value": {"JobDictionary": {123: "foo", 456: "bar"}}} sOkJobs = {"OK": True, "Value": {123: "foo", 456: "bar"}} diff --git a/src/DIRAC/TransformationSystem/Client/RequestTasks.py b/src/DIRAC/TransformationSystem/Client/RequestTasks.py index 31c5c0ede70..d3627313005 100644 --- a/src/DIRAC/TransformationSystem/Client/RequestTasks.py +++ b/src/DIRAC/TransformationSystem/Client/RequestTasks.py @@ -2,7 +2,6 @@ from DIRAC import S_OK, S_ERROR, gLogger -from DIRAC.ConfigurationSystem.Client.Helpers.Registry import getDNForUsername from DIRAC.Core.Security.ProxyInfo import getProxyInfo from DIRAC.Core.Utilities.JEncode import decode diff --git a/src/DIRAC/TransformationSystem/Client/Transformation.py b/src/DIRAC/TransformationSystem/Client/Transformation.py index 6b9af3cff6b..d9a49ac5852 100644 --- a/src/DIRAC/TransformationSystem/Client/Transformation.py +++ b/src/DIRAC/TransformationSystem/Client/Transformation.py @@ -11,7 +11,6 @@ from DIRAC.TransformationSystem.Client.BodyPlugin.BaseBody import BaseBody from DIRAC.TransformationSystem.Client.TransformationClient import TransformationClient from DIRAC.ConfigurationSystem.Client.Helpers.Operations import Operations -from DIRAC.Core.Security.ProxyInfo import getProxyInfo from DIRAC.RequestManagementSystem.Client.Operation import Operation COMPONENT_NAME = "Transformation" @@ -269,7 +268,7 @@ def getTransformationLogging(self, printOutput=False): loggingList = res["Value"] if printOutput: self._printFormattedDictList( - loggingList, ["Message", "MessageDate", "AuthorDN"], "MessageDate", "MessageDate" + loggingList, ["Message", "MessageDate", "Author"], "MessageDate", "MessageDate" ) return S_OK(loggingList) @@ -425,63 +424,19 @@ def getTransformations( self._printFormattedDictList(res["Value"], outputFields, "TransformationID", orderBy) return res - ############################################################################# - def getAuthorDNfromProxy(self): - """gets the AuthorDN and username of the transformation from the uploaded proxy""" - username = "" - author = "" - res = getProxyInfo() - if res["OK"]: - author = res["Value"]["identity"] - username = res["Value"]["username"] - else: - gLogger.error(f"Unable to get uploaded proxy Info {res['Message']} ") - return S_ERROR(res["Message"]) - - res = {"username": username, "authorDN": author} - return S_OK(res) - ############################################################################# def getTransformationsByUser( self, - authorDN="", userName="", transID=[], transStatus=[], - outputFields=["TransformationID", "Status", "AgentType", "TransformationName", "CreationDate", "AuthorDN"], + outputFields=["TransformationID", "Status", "AgentType", "TransformationName", "CreationDate", "Author"], orderBy="TransformationID", printOutput=False, ): condDict = {} - if authorDN == "": - res = self.getAuthorDNfromProxy() - if not res["OK"]: - gLogger.error(res["Message"]) - return S_ERROR(res["Message"]) - else: - foundUserName = res["Value"]["username"] - foundAuthor = res["Value"]["authorDN"] - # If the username whom created the uploaded proxy is different than the provided username report error and exit - if not (userName == "" or userName == foundUserName): - gLogger.error( - "Couldn't resolve the authorDN for user '%s' from the uploaded proxy (proxy created by '%s')" - % (userName, foundUserName) - ) - return S_ERROR( - "Couldn't resolve the authorDN for user '%s' from the uploaded proxy (proxy created by '%s')" - % (userName, foundUserName) - ) - - userName = foundUserName - authorDN = foundAuthor - gLogger.info( - "Will list transformations created by user '%s' with status '%s'" - % (userName, ", ".join(transStatus)) - ) - else: - gLogger.info(f"Will list transformations created by '{authorDN}' with status '{', '.join(transStatus)}'") - - condDict["AuthorDN"] = authorDN + gLogger.info(f"Will list transformations created by user '{userName}' with status '{transStatus}'") + condDict["Author"] = userName if transID: condDict["TransformationID"] = transID if transStatus: diff --git a/src/DIRAC/TransformationSystem/Client/TransformationCLI.py b/src/DIRAC/TransformationSystem/Client/TransformationCLI.py index 4108da6fa88..9a8d0399d2b 100644 --- a/src/DIRAC/TransformationSystem/Client/TransformationCLI.py +++ b/src/DIRAC/TransformationSystem/Client/TransformationCLI.py @@ -112,53 +112,22 @@ def do_getall(self, args): def do_getAllByUser(self, args): """Get all transformations created by a given user - The first argument is the authorDN or username. The authorDN - is preferred: it need to be inside quotes because contains - white spaces. Only authorDN should be quoted. + The first argument is the username. - When the username is provided instead, - the authorDN is retrieved from the uploaded proxy, - so that the retrieved transformations are those created by - the user who uploaded that proxy: that user could be different - that the username provided to the function. - - usage: getAllByUser authorDN or username [Status] [Status] + usage: getAllByUser username [Status] [Status] """ oTrans = Transformation() argss = args.split() username = "" - author = "" status = [] if not len(argss) > 0: print(self.do_getAllByUser.__doc__) return - # if the user didnt quoted the authorDN ends - if "=" in argss[0] and argss[0][0] not in ["'", '"']: - print("AuthorDN need to be quoted (just quote that argument)") - return + username = argss[0] + status = argss[1:] - if argss[0][0] in ["'", '"']: # authorDN given - author = argss[0] - status_idx = 1 - for arg in argss[1:]: - author += " " + arg - status_idx += 1 - if arg[-1] in ["'", '"']: - break - # At this point we should have something like 'author' - if not author[0] in ["'", '"'] or not author[-1] in ["'", '"']: - print("AuthorDN need to be quoted (just quote that argument)") - return - else: - author = author[1:-1] # throw away the quotes - # the rest are the requested status - status = argss[status_idx:] - else: # username given - username = argss[0] - status = argss[1:] - - oTrans.getTransformationsByUser(authorDN=author, userName=username, transStatus=status, printOutput=True) + oTrans.getTransformationsByUser(userName=username, transStatus=status, printOutput=True) def do_summaryTransformations(self, args): """Show the summary for a list of Transformations diff --git a/src/DIRAC/TransformationSystem/DB/TransformationDB.py b/src/DIRAC/TransformationSystem/DB/TransformationDB.py index 37ec1b752cd..8e31d95e5e4 100755 --- a/src/DIRAC/TransformationSystem/DB/TransformationDB.py +++ b/src/DIRAC/TransformationSystem/DB/TransformationDB.py @@ -55,7 +55,7 @@ def __init__(self, dbname=None, dbconfig=None, dbIn=None, parentLogger=None): "LongDescription", "CreationDate", "LastUpdate", - "AuthorDN", + "Author", "AuthorGroup", "Type", "Plugin", @@ -129,7 +129,7 @@ def addTransformation( transName, description, longDescription, - authorDN, + author, authorGroup, transType, plugin, @@ -162,7 +162,7 @@ def addTransformation( body = res["Value"] req = ( "INSERT INTO Transformations (TransformationName,Description,LongDescription, \ - CreationDate,LastUpdate,AuthorDN,AuthorGroup,Type,Plugin,AgentType,\ + CreationDate,LastUpdate,Author,AuthorGroup,Type,Plugin,AgentType,\ FileMask,Status,TransformationGroup,GroupSize,\ InheritedFrom,Body,MaxNumberOfTasks,EventsPerTask)\ VALUES ('%s','%s','%s',\ @@ -173,7 +173,7 @@ def addTransformation( transName, description, longDescription, - authorDN, + author, authorGroup, transType, plugin, @@ -218,19 +218,19 @@ def addTransformation( originalID = res["Value"] # FIXME: this is not the right place to change status information, and in general the whole should not be here res = self.setTransformationParameter( - originalID, "Status", "Completing", author=authorDN, connection=connection + originalID, "Status", "Completing", author=author, connection=connection ) if not res["OK"]: gLogger.error("Failed to update parent transformation status: now deleting", res["Message"]) return self.deleteTransformation(transID, connection=connection) res = self.setTransformationParameter( - originalID, "AgentType", "Automatic", author=authorDN, connection=connection + originalID, "AgentType", "Automatic", author=author, connection=connection ) if not res["OK"]: gLogger.error("Failed to update parent transformation agent type, now deleting", res["Message"]) return self.deleteTransformation(transID, connection=connection) message = "Creation of the derived transformation (%d)" % transID - self.__updateTransformationLogging(originalID, message, authorDN, connection=connection) + self.__updateTransformationLogging(originalID, message, author, connection=connection) res = self.getTransformationFiles(condDict={"TransformationID": originalID}, connection=connection) if not res["OK"]: gLogger.error("Could not get transformation files, now deleting", res["Message"]) @@ -266,7 +266,7 @@ def addTransformation( gLogger.error("Failed to add files to transformation", f"{transID} {res['Message']}") message = "Created transformation %d" % transID - self.__updateTransformationLogging(transID, message, authorDN, connection=connection) + self.__updateTransformationLogging(transID, message, author, connection=connection) return S_OK(transID) def getTransformations( @@ -1268,19 +1268,19 @@ def __deleteTransformationTaskInputs(self, transID, taskID=0, connection=False): # These methods manipulate the TransformationLog table # - def __updateTransformationLogging(self, transName, message, authorDN, connection=False): + def __updateTransformationLogging(self, transName, message, author, connection=False): """Update the Transformation log table with any modifications""" - if not authorDN: + if not author: res = getProxyInfo(False, False) if res["OK"]: - authorDN = res["Value"]["subject"] + author = res["Value"]["username"] res = self._getConnectionTransID(connection, transName) if not res["OK"]: return res connection = res["Value"]["Connection"] transID = res["Value"]["TransformationID"] req = "INSERT INTO TransformationLog (TransformationID,Message,Author,MessageDate)" - req = req + f" VALUES ({transID},'{message}','{authorDN}',UTC_TIMESTAMP());" + req = req + f" VALUES ({transID},'{message}','{author}',UTC_TIMESTAMP());" return self._update(req, conn=connection) def getTransformationLogging(self, transName, connection=False): @@ -1296,11 +1296,11 @@ def getTransformationLogging(self, transName, connection=False): if not res["OK"]: return res transList = [] - for transID, message, authorDN, messageDate in res["Value"]: + for transID, message, author, messageDate in res["Value"]: transDict = {} transDict["TransformationID"] = transID transDict["Message"] = message - transDict["AuthorDN"] = authorDN + transDict["Author"] = author transDict["MessageDate"] = messageDate transList.append(transDict) return S_OK(transList) diff --git a/src/DIRAC/TransformationSystem/DB/TransformationDB.sql b/src/DIRAC/TransformationSystem/DB/TransformationDB.sql index 04be76b9c2f..d08fc12ba5e 100755 --- a/src/DIRAC/TransformationSystem/DB/TransformationDB.sql +++ b/src/DIRAC/TransformationSystem/DB/TransformationDB.sql @@ -28,12 +28,13 @@ CREATE TABLE Transformations( LongDescription TEXT, CreationDate DATETIME, LastUpdate DATETIME, + Author VARCHAR(255) NOT NULL, AuthorDN VARCHAR(255) NOT NULL, AuthorGroup VARCHAR(255) NOT NULL, Type CHAR(32) DEFAULT 'Simulation', Plugin CHAR(32) DEFAULT 'None', AgentType CHAR(32) DEFAULT 'Manual', - Status CHAR(32) DEFAULT 'New', + Status CHAR(32) DEFAULT 'New', FileMask VARCHAR(255), TransformationGroup varchar(255) NOT NULL default 'General', TransformationFamily varchar(64) default '0', diff --git a/src/DIRAC/TransformationSystem/Service/TransformationManagerHandler.py b/src/DIRAC/TransformationSystem/Service/TransformationManagerHandler.py index b550f4446b5..5c3789a778e 100644 --- a/src/DIRAC/TransformationSystem/Service/TransformationManagerHandler.py +++ b/src/DIRAC/TransformationSystem/Service/TransformationManagerHandler.py @@ -67,16 +67,14 @@ def export_addTransformation( inputMetaQuery=None, outputMetaQuery=None, ): - # authorDN = self._clientTransport.peerCredentials['DN'] - # authorGroup = self._clientTransport.peerCredentials['group'] credDict = self.getRemoteCredentials() - authorDN = credDict.get("DN", credDict.get("CN")) + author = credDict.get("username") authorGroup = credDict.get("group") res = self.transformationDB.addTransformation( transName, description, longDescription, - authorDN, + author, authorGroup, transType, plugin, @@ -100,41 +98,34 @@ def export_addTransformation( def export_deleteTransformation(self, transName): credDict = self.getRemoteCredentials() - authorDN = credDict.get("DN", credDict.get("CN")) - # authorDN = self._clientTransport.peerCredentials['DN'] - return self.transformationDB.deleteTransformation(transName, author=authorDN) + author = credDict.get("username") + return self.transformationDB.deleteTransformation(transName, author=author) types_completeTransformation = [[int, str]] def export_completeTransformation(self, transName): credDict = self.getRemoteCredentials() - authorDN = credDict.get("DN", credDict.get("CN")) - # authorDN = self._clientTransport.peerCredentials['DN'] - return self.transformationDB.setTransformationParameter(transName, "Status", "Completed", author=authorDN) + author = credDict.get("username") + return self.transformationDB.setTransformationParameter(transName, "Status", "Completed", author=author) types_cleanTransformation = [[int, str]] def export_cleanTransformation(self, transName): credDict = self.getRemoteCredentials() - authorDN = credDict.get("DN", credDict.get("CN")) - # authorDN = self._clientTransport.peerCredentials['DN'] - return self.transformationDB.cleanTransformation(transName, author=authorDN) + author = credDict.get("username") + return self.transformationDB.cleanTransformation(transName, author=author) types_setTransformationParameter = [[int, str], str] def export_setTransformationParameter(self, transName, paramName, paramValue): credDict = self.getRemoteCredentials() - authorDN = credDict.get("DN", credDict.get("CN")) - # authorDN = self._clientTransport.peerCredentials['DN'] - return self.transformationDB.setTransformationParameter(transName, paramName, paramValue, author=authorDN) + author = credDict.get("username") + return self.transformationDB.setTransformationParameter(transName, paramName, paramValue, author=author) types_deleteTransformationParameter = [[int, str], str] @classmethod def export_deleteTransformationParameter(cls, transName, paramName): - # credDict = self.getRemoteCredentials() - # authorDN = credDict[ 'DN' ] - # authorDN = self._clientTransport.peerCredentials['DN'] return cls.transformationDB.deleteTransformationParameter(transName, paramName) types_getTransformations = [] @@ -315,17 +306,15 @@ def export_getTransformationTaskStats(cls, transName): def export_deleteTasks(self, transName, taskMin, taskMax): credDict = self.getRemoteCredentials() - authorDN = credDict.get("DN", credDict.get("CN")) - # authorDN = self._clientTransport.peerCredentials['DN'] - return self.transformationDB.deleteTasks(transName, taskMin, taskMax, author=authorDN) + author = credDict.get("username") + return self.transformationDB.deleteTasks(transName, taskMin, taskMax, author=author) types_extendTransformation = [[int, str], int] def export_extendTransformation(self, transName, nTasks): credDict = self.getRemoteCredentials() - authorDN = credDict.get("DN", credDict.get("CN")) - # authorDN = self._clientTransport.peerCredentials['DN'] - return self.transformationDB.extendTransformation(transName, nTasks, author=authorDN) + author = credDict.get("username") + return self.transformationDB.extendTransformation(transName, nTasks, author=author) types_getTasksToSubmit = [[int, str], int] @@ -361,15 +350,15 @@ def export_getTasksToSubmit(self, transName, numTasks, site=""): def export_createTransformationMetaQuery(self, transName, queryDict, queryType): credDict = self.getRemoteCredentials() - authorDN = credDict.get("DN", credDict.get("CN")) - return self.transformationDB.createTransformationMetaQuery(transName, queryDict, queryType, author=authorDN) + author = credDict.get("username") + return self.transformationDB.createTransformationMetaQuery(transName, queryDict, queryType, author=author) types_deleteTransformationMetaQuery = [[int, str], str] def export_deleteTransformationMetaQuery(self, transName, queryType): credDict = self.getRemoteCredentials() - authorDN = credDict.get("DN", credDict.get("CN")) - return self.transformationDB.deleteTransformationMetaQuery(transName, queryType, author=authorDN) + author = credDict.get("username") + return self.transformationDB.deleteTransformationMetaQuery(transName, queryType, author=author) types_getTransformationMetaQuery = [[int, str], str] diff --git a/src/DIRAC/TransformationSystem/Utilities/TransformationInfo.py b/src/DIRAC/TransformationSystem/Utilities/TransformationInfo.py index 399114bb669..b7963f895ee 100644 --- a/src/DIRAC/TransformationSystem/Utilities/TransformationInfo.py +++ b/src/DIRAC/TransformationSystem/Utilities/TransformationInfo.py @@ -24,7 +24,7 @@ def __init__(self, transformationID, transInfoDict, enabled, tClient, fcClient, self.jobMon = jobMon self.fcClient = fcClient self.transType = transInfoDict["Type"] - self.authorDN = transInfoDict["AuthorDN"] + self.author = transInfoDict["Author"] self.authorGroup = transInfoDict["AuthorGroup"] self.jobStateClient = JobStateUpdateClient() @@ -140,7 +140,7 @@ def cleanOutputs(self, jobInfo): successfullyRemoved = 0 for lfnList in breakListIntoChunks(filesToDelete, 200): - with UserProxy(proxyUserDN=self.authorDN, proxyUserGroup=self.authorGroup) as proxyResult: + with UserProxy(proxyUserName=self.author, proxyUserGroup=self.authorGroup) as proxyResult: if not proxyResult["OK"]: raise RuntimeError(f"Failed to get a proxy: {proxyResult['Message']}") result = DataManager().removeFile(lfnList) diff --git a/src/DIRAC/TransformationSystem/scripts/dirac_transformation_information.py b/src/DIRAC/TransformationSystem/scripts/dirac_transformation_information.py index cfe75efbb80..03a0ae6e9bd 100755 --- a/src/DIRAC/TransformationSystem/scripts/dirac_transformation_information.py +++ b/src/DIRAC/TransformationSystem/scripts/dirac_transformation_information.py @@ -12,8 +12,8 @@ @Script() def main(): - informations = [ - "AuthorDN", + information = [ + "Author", "AuthorGroup", "Body", "CreationDate", @@ -37,13 +37,13 @@ def main(): tr = TransformationClient() - requestedInfo = informations + requestedInfo = information switches = Script.getUnprocessedSwitches() infoList = [] for switch, val in switches: if switch == "Information": infoList = [info.lower() for info in val.split(",")] - requestedInfo = [info for info in informations if info.lower() in infoList] + requestedInfo = [info for info in information if info.lower() in infoList] if "body" not in infoList and "Body" in requestedInfo: requestedInfo.remove("Body") diff --git a/src/DIRAC/TransformationSystem/test/Test_DRA.py b/src/DIRAC/TransformationSystem/test/Test_DRA.py index a8b07b4e836..510343641dd 100644 --- a/src/DIRAC/TransformationSystem/test/Test_DRA.py +++ b/src/DIRAC/TransformationSystem/test/Test_DRA.py @@ -92,7 +92,7 @@ def test_getEligibleTransformations_success(self): TransformationID=1234, TransformationName="TestProd12", Type="TestProd", - AuthorDN="/some/cert/owner", + Author="owner", AuthorGroup="Test_Prod", ) self.dra.tClient.getTransformations = Mock(return_value=S_OK([transInfoDict])) @@ -122,7 +122,7 @@ def test_treatTransformation1(self): TransformationID=1234, TransformationName="TestProd12", Type="TestProd", - AuthorDN="/some/cert/owner", + Author="owner", AuthorGroup="Test_Prod", ) with patch(f"{MODULE_NAME}.TransformationInfo", new=tinfoMock): @@ -142,7 +142,7 @@ def test_treatTransformation2(self): TransformationID=1234, TransformationName="TestProd12", Type="MCSimulation", - AuthorDN="/some/cert/owner", + Author="owner", AuthorGroup="Test_Prod", ) with patch(f"{MODULE_NAME}.TransformationInfo", new=tinfoMock): @@ -160,7 +160,7 @@ def test_treatTransformation3(self): TransformationID=1234, TransformationName="TestProd12", Type="TestProd", - AuthorDN="/some/cert/owner", + Author="owner", AuthorGroup="Test_Prod", ) @@ -449,21 +449,21 @@ def test_execute(self): TransformationID=123, TransformationName="TestProd123", Type="MCGeneration", - AuthorDN="/some/cert/owner", + Author="owner", AuthorGroup="Test_Prod", ) d124 = dict( TransformationID=124, TransformationName="TestProd124", Type="MCGeneration", - AuthorDN="/some/cert/owner", + Author="owner", AuthorGroup="Test_Prod", ) d125 = dict( TransformationID=125, TransformationName="TestProd125", Type="MCGeneration", - AuthorDN="/some/cert/owner", + Author="owner", AuthorGroup="Test_Prod", ) diff --git a/src/DIRAC/TransformationSystem/test/Test_JobInfo.py b/src/DIRAC/TransformationSystem/test/Test_JobInfo.py index 03016590a2d..dd195215417 100644 --- a/src/DIRAC/TransformationSystem/test/Test_JobInfo.py +++ b/src/DIRAC/TransformationSystem/test/Test_JobInfo.py @@ -40,7 +40,7 @@ def setUp(self): "Priority": 1, "Platform": "x86_64-slc5-gcc43-opt", "JobRequirements": { - "OwnerDN": "/DC=ch/DC=cern/OU=Organic Units/OU=Users/CN=sailer/CN=683529/CN=Andre Sailer", + "Owner": "asailer", "VirtualOrganization": "ilc", "Setup": "ILC-Production", "CPUTime": 300000, @@ -80,7 +80,7 @@ def setUp(self): "TransformationID": 6326, "StdError": "std.err", "IS_PROD": "True", - "OwnerDN": "/DC=ch/DC=cern/OU=Organic Units/OU=Users/CN=sailer/CN=683529/CN=Andre Sailer", + "Owner": "asailer", "JobGroup": 0o0006326, "OutputSandbox": [ "std.err", @@ -107,7 +107,7 @@ def setUp(self): "Priority": 1, "Platform": "x86_64-slc5-gcc43-opt", "JobRequirements": { - "OwnerDN": "/DC=ch/DC=cern/OU=Organic Units/OU=Users/CN=sailer/CN=683529/CN=Andre Sailer", + "Owner": "asailer", "VirtualOrganization": "ilc", "Setup": "ILC-Production", "CPUTime": 300000, @@ -147,7 +147,7 @@ def setUp(self): "TransformationID": 6326, "StdError": "std.err", "IS_PROD": "True", - "OwnerDN": "/DC=ch/DC=cern/OU=Organic Units/OU=Users/CN=sailer/CN=683529/CN=Andre Sailer", + "Owner": "asailer", "JobGroup": 0o0006326, "OutputSandbox": [ "std.err", @@ -175,7 +175,7 @@ def setUp(self): "Priority": 1, "Platform": "x86_64-slc5-gcc43-opt", "JobRequirements": { - "OwnerDN": "/DC=ch/DC=cern/OU=Organic Units/OU=Users/CN=sailer/CN=683529/CN=Andre Sailer", + "Owner": "asailer", "VirtualOrganization": "ilc", "Setup": "ILC-Production", "CPUTime": 300000, @@ -218,7 +218,7 @@ def setUp(self): "TransformationID": 6301, "StdError": "std.err", "IS_PROD": "True", - "OwnerDN": "/DC=ch/DC=cern/OU=Organic Units/OU=Users/CN=sailer/CN=683529/CN=Andre Sailer", + "Owner": "asailer", "JobGroup": "00006301", "OutputSandbox": [ "std.err", @@ -242,7 +242,7 @@ def setUp(self): "Priority": 1, "Platform": "x86_64-slc5-gcc43-opt", "JobRequirements": { - "OwnerDN": "/DC=ch/DC=cern/OU=Organic Units/OU=Users/CN=sailer/CN=683529/CN=Andre Sailer", + "Owner": "asailer", "VirtualOrganization": "ilc", "Setup": "ILC-Production", "CPUTime": 300000, @@ -275,7 +275,7 @@ def setUp(self): "TransformationID": 6498, "StdError": "std.err", "IS_PROD": "True", - "OwnerDN": "/DC=ch/DC=cern/OU=Organic Units/OU=Users/CN=sailer/CN=683529/CN=Andre Sailer", + "Owner": "asailer", "JobGroup": "00006498", "OutputSandbox": [ "std.err", diff --git a/src/DIRAC/TransformationSystem/test/Test_TransformationInfo.py b/src/DIRAC/TransformationSystem/test/Test_TransformationInfo.py index 673bb305037..80403043327 100644 --- a/src/DIRAC/TransformationSystem/test/Test_TransformationInfo.py +++ b/src/DIRAC/TransformationSystem/test/Test_TransformationInfo.py @@ -58,7 +58,7 @@ def tiFixture(): TransformationID=1234, TransformationName="TestProd12", Type="TestProd", - AuthorDN="/some/cert/owner", + Author="owner", AuthorGroup="Test_Prod", )