Skip to content

Commit 545e07e

Browse files
committed
fix: create separate handler class for each component
1 parent 9a6846d commit 545e07e

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/DIRAC/Core/Tornado/Server/HandlerManager.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -110,13 +110,14 @@ def __load(self, instances, componentType, pathFinder):
110110
result = loader.loadModules(instances)
111111
if result["OK"]:
112112
for module in loader.getModules().values():
113-
handler = module["classObj"]
113+
# Make a separate class per component that can be individually configured
114+
tornadoHandlerClassName = f"{module['modName'].replace('/', '')}Handler"
114115
fullComponentName = module["modName"]
116+
handler = type(
117+
tornadoHandlerClassName, (module["classObj"],), {"_fullComponentName": fullComponentName}
118+
)
115119

116-
# Define the system and component name as the attributes of the handler that belongs to them
117-
handler.SYSTEM_NAME, handler.COMPONENT_NAME = fullComponentName.split("/")
118-
119-
gLogger.info("Found new handler", f"{fullComponentName}: {handler}")
120+
gLogger.info("Found new handler", f"{fullComponentName}: {module['classObj']}")
120121

121122
# at this stage we run the basic handler initialization
122123
# see DIRAC.Core.Tornado.Server.private.BaseRequestHandler for more details

0 commit comments

Comments
 (0)