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

[devel] send a VO name with a log message (address issue #229 #230

Merged
merged 1 commit into from
Feb 8, 2024
Merged
Show file tree
Hide file tree
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
3 changes: 2 additions & 1 deletion Pilot/dirac-pilot.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@
if not sys.stdin.isatty():
receivedContent = sys.stdin.read()
log = RemoteLogger(
pilotParams.loggerURL, "Pilot", bufsize=pilotParams.loggerBufsize, pilotUUID=pilotParams.pilotUUID, debugFlag=pilotParams.debugFlag
pilotParams.loggerURL, "Pilot", bufsize=pilotParams.loggerBufsize,
pilotUUID=pilotParams.pilotUUID, debugFlag=pilotParams.debugFlag, wnVO=pilotParams.wnVO,
)
log.info("Remote logger activated")
log.buffer.write(receivedContent)
Expand Down
9 changes: 6 additions & 3 deletions Pilot/pilotTools.py
Original file line number Diff line number Diff line change
Expand Up @@ -513,6 +513,7 @@ def __init__(
pilotUUID="unknown",
flushInterval=10,
bufsize=1000,
wnVO = "unknown",
):
"""
c'tor
Expand All @@ -523,7 +524,7 @@ def __init__(
self.url = url
self.pilotUUID = pilotUUID
self.isPilotLoggerOn = isPilotLoggerOn
sendToURL = partial(sendMessage, url, pilotUUID, "sendMessage")
sendToURL = partial(sendMessage, url, pilotUUID, wnVO, "sendMessage")
self.buffer = FixedSizeBuffer(sendToURL, bufsize=bufsize, autoflush=flushInterval)

def debug(self, msg, header=True, sendPilotLog=False):
Expand Down Expand Up @@ -668,12 +669,13 @@ def cancelTimer(self):
self._timer.cancel()


def sendMessage(url, pilotUUID, method, rawMessage):
def sendMessage(url, pilotUUID, wnVO, method, rawMessage):
"""
Invoke a remote method on a Tornado server and pass a JSON message to it.

:param str url: Server URL
:param str pilotUUID: pilot unique ID
:param str wnVO: VO name, relevant only if not contained in a proxy
:param str method: a method to be invoked
:param str rawMessage: a message to be sent, in JSON format
:return: None.
Expand All @@ -684,7 +686,7 @@ def sendMessage(url, pilotUUID, method, rawMessage):
context = ssl.create_default_context()
context.load_verify_locations(capath=caPath)

message = json.dumps((json.dumps(rawMessage), pilotUUID))
message = json.dumps((json.dumps(rawMessage), pilotUUID, wnVO))

try:
context.load_cert_chain(cert) # this is a proxy
Expand Down Expand Up @@ -737,6 +739,7 @@ def __init__(self, pilotParams, dummy=""):
debugFlag=self.debugFlag,
flushInterval=interval,
bufsize=bufsize,
wnVO=pilotParams.wnVO,
)

self.log.isPilotLoggerOn = isPilotLoggerOn
Expand Down
Loading