Skip to content

Commit 63d3639

Browse files
committed
feat (WMS): Improved logging in executor infrastructure
1 parent 1ed56c5 commit 63d3639

File tree

4 files changed

+12
-14
lines changed

4 files changed

+12
-14
lines changed

src/DIRAC/Core/Base/ExecutorMindHandler.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ def __sendTask(self, taskId, taskObj, eId, eType):
124124
taskStub = result["Value"]
125125
result = self.srv_msgCreate("ProcessTask")
126126
if not result["OK"]:
127+
gLogger.error("Failed to create message for", "%s %r" % (taskId, result))
127128
return result
128129
msgObj = result["Value"]
129130
msgObj.taskId = taskId

src/DIRAC/Core/DISET/MessageClient.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -83,14 +83,12 @@ def __cbDisconnect(self, trid):
8383
self.__trid = False
8484
try:
8585
self.__transport.close()
86-
except BaseException:
86+
except Exception:
8787
pass
8888
for cb in self.__specialCallbacks["drop"]:
8989
try:
9090
cb(self)
91-
except SystemExit:
92-
raise
93-
except BaseException:
91+
except Exception:
9492
gLogger.exception("Exception while processing disconnect callbacks")
9593

9694
def __cbRecvMsg(self, trid, msgObj):
@@ -107,7 +105,7 @@ def __cbRecvMsg(self, trid, msgObj):
107105
# If no specific callback but a generic one, return the generic one
108106
if msgName not in self.__callbacks:
109107
return result
110-
except BaseException:
108+
except Exception:
111109
gLogger.exception("Exception while processing callbacks", msgObj.getName())
112110
if msgName not in self.__callbacks:
113111
return S_ERROR("Unexpected message")
@@ -117,7 +115,7 @@ def __cbRecvMsg(self, trid, msgObj):
117115
gLogger.error("Callback for message does not return S_OK/S_ERROR", msgName)
118116
return S_ERROR("No response")
119117
return result
120-
except BaseException:
118+
except Exception:
121119
gLogger.exception("Exception while processing callbacks", msgName)
122120
return S_ERROR("No response")
123121

@@ -128,6 +126,7 @@ def sendMessage(self, msgObj):
128126
if not self.__trid:
129127
result = self.connect()
130128
if not result["OK"]:
129+
gLogger.error("Failed connect for sending", "%r" % msgObj)
131130
return result
132131
return self.__msgBroker.sendMessage(self.__trid, msgObj)
133132

src/DIRAC/Core/DISET/private/MessageBroker.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -165,12 +165,8 @@ def __listenAutoReceiveConnections(self):
165165

166166
try:
167167
events = sel.select(timeout=1)
168-
except (socket.error, select.error):
169-
# TODO: When can this happen?
170-
time.sleep(0.001)
171-
continue
172-
except Exception as e:
173-
gLogger.exception("Exception while selecting persistent connections", lException=e)
168+
except Exception:
169+
gLogger.exception("Exception while selecting persistent connections")
174170
continue
175171

176172
for key, event in events:
@@ -205,7 +201,7 @@ def __receiveMsgDataAndQueue(self, trid):
205201

206202
def __processIncomingData(self, trid, receivedResult):
207203
# If keep alive, return OK
208-
if "keepAlive" in receivedResult and receivedResult["keepAlive"]:
204+
if receivedResult.get("keepAlive"):
209205
return S_OK()
210206
# If idle read return
211207
self.__trInOutLock.acquire()

src/DIRAC/Core/Utilities/ExecutorDispatcher.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -426,7 +426,7 @@ def addExecutor(self, eId, eTypes, maxTasks=1):
426426
self.__fillExecutors(eType)
427427

428428
def removeExecutor(self, eId):
429-
self.__log.verbose("Removing executor %s" % eId)
429+
self.__log.info("Removing executor %s" % eId)
430430
self.__executorsLock.acquire()
431431
try:
432432
if eId not in self.__idMap:
@@ -845,6 +845,8 @@ def __msgTaskToExecutor(self, taskId, eId, eType):
845845
errMsg = "Send task callback did not send back an S_OK/S_ERROR structure"
846846
self.__log.fatal(errMsg)
847847
raise ValueError(errMsg)
848+
if not result["OK"]:
849+
self.__log.error("Failed to cbSendTask", "%r" % result)
848850

849851

850852
class UnrecoverableTaskException(Exception):

0 commit comments

Comments
 (0)