Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[integration] add a wnVO argument to sendMessage and finaliseLogs #7425

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Comment on lines +71 to +72
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In theory, we could have the case where vo is different from 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
Loading