Skip to content

Commit

Permalink
Merge pull request DIRACGrid#7425 from martynia/integration_janusz_pi…
Browse files Browse the repository at this point in the history
…lotlogs_sendVO

[integration] add a wnVO argument to sendMessage and finaliseLogs
  • Loading branch information
fstagni authored Jan 30, 2024
2 parents 9f7e8d2 + 38154ef commit c04121d
Showing 1 changed file with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,15 @@ 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.
The pilot is identified by its UUID.
: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
"""
Expand All @@ -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)
Expand All @@ -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)
Expand Down

0 comments on commit c04121d

Please sign in to comment.