From 38154ef204ff5c2f03162135d4fb1a241cf5b359 Mon Sep 17 00:00:00 2001 From: martynia Date: Thu, 25 Jan 2024 20:35:07 +0000 Subject: [PATCH] feat: add a wnVO argument to sendMessage and finaliseLogs --- .../Service/TornadoPilotLoggingHandler.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/DIRAC/WorkloadManagementSystem/Service/TornadoPilotLoggingHandler.py b/src/DIRAC/WorkloadManagementSystem/Service/TornadoPilotLoggingHandler.py index 512a136ca7c..61212c81ef4 100644 --- a/src/DIRAC/WorkloadManagementSystem/Service/TornadoPilotLoggingHandler.py +++ b/src/DIRAC/WorkloadManagementSystem/Service/TornadoPilotLoggingHandler.py @@ -50,7 +50,7 @@ def initializeHandler(cls, infoDict): os.makedirs(logPath) cls.log.verbose("Pilot logging directory:", logPath) - def export_sendMessage(self, message, pilotUUID): + def export_sendMessage(self, message, pilotUUID, wnVO): # def export_sendMessage(self, message, pilotUUID): """ The method logs messages to Tornado and forwards pilot log files, one per pilot, to a relevant plugin. @@ -58,6 +58,7 @@ def export_sendMessage(self, message, pilotUUID): :param message: message sent by a client, a list of strings in JSON format :param pilotUUID: pilot UUID + :param pilotUUID: VO manually enforced by a client, used if no VO in a proxy/token :return: S_OK or S_ERROR if a plugin cannot process the message. :rtype: dict """ @@ -67,6 +68,9 @@ def export_sendMessage(self, message, pilotUUID): # determine client VO vo = self.__getClientVO() + if vo == "": + vo = wnVO + # the plugin returns S_OK or S_ERROR # leave JSON decoding to the selected plugin: result = self.loggingPlugin.sendMessage(message, pilotUUID, vo) @@ -90,18 +94,21 @@ def export_getLogs(self, logfile, vo): return self.loggingPlugin.getLogs(logfile, vo) - def export_finaliseLogs(self, payload, pilotUUID): + def export_finaliseLogs(self, payload, pilotUUID, wnVO): """ Finalise a log file. Finalised logfile can be copied to a secure location, if a file cache is used. :param payload: data passed to the plugin finaliser. :type payload: dict :param pilotUUID: pilot UUID + :param pilotUUID: VO manually enforced by a client, used if no VO in a proxy/token :return: S_OK or S_ERROR (via the plugin involved) :rtype: dict """ vo = self.__getClientVO() + if vo == "": + vo = wnVO # The plugin returns the Dirac S_OK or S_ERROR object return self.loggingPlugin.finaliseLogs(payload, pilotUUID, vo)