From c3281a459b8ea7160d3473e953c529f72ac38097 Mon Sep 17 00:00:00 2001 From: Christophe Haen Date: Mon, 4 Dec 2023 15:58:16 +0100 Subject: [PATCH] debug segfault --- src/DIRAC/Core/DISET/RequestHandler.py | 26 ++++++++++++++++++- .../Core/Tornado/Server/TornadoService.py | 25 +++++++++++++++++- 2 files changed, 49 insertions(+), 2 deletions(-) diff --git a/src/DIRAC/Core/DISET/RequestHandler.py b/src/DIRAC/Core/DISET/RequestHandler.py index cff7be520c2..683b865cb1d 100755 --- a/src/DIRAC/Core/DISET/RequestHandler.py +++ b/src/DIRAC/Core/DISET/RequestHandler.py @@ -3,7 +3,7 @@ import os import time, datetime import psutil - +from time import sleep import DIRAC from DIRAC.Core.DISET.private.FileHelper import FileHelper @@ -527,6 +527,30 @@ def export_whoami(self): del credDict["x509Chain"] return S_OK(credDict) + types_sleep = [int] + auth_sleep = ["all"] + + def export_sleep(self, sleepTime): + """ + A simple sleep + """ + sleep(sleepTime) + return S_OK(sleepTime) + + types_dbSleep = [int] + auth_dbSleep = ["all"] + + def export_dbSleep(self, sleepTime): + """ + A simple sleep + """ + try: + dbInst = [getattr(self, attr) for attr in dir(self)][0] + dbInst._query(f"SELECT 'IN DB', SLEEP({sleepTime})") + return S_OK(sleepTime) + except Exception as e: + return S_ERROR(f"Issue doing DB sleep {e!r}") + types_echo = [str] @staticmethod diff --git a/src/DIRAC/Core/Tornado/Server/TornadoService.py b/src/DIRAC/Core/Tornado/Server/TornadoService.py index eee0797558c..0cd7e12c6c4 100644 --- a/src/DIRAC/Core/Tornado/Server/TornadoService.py +++ b/src/DIRAC/Core/Tornado/Server/TornadoService.py @@ -7,10 +7,11 @@ import os from datetime import datetime from tornado.web import url as TornadoURL +from time import sleep import DIRAC -from DIRAC import gLogger, S_OK +from DIRAC import gLogger, S_OK, S_ERROR from DIRAC.Core.Tornado.Server.private.BaseRequestHandler import BaseRequestHandler from DIRAC.ConfigurationSystem.Client import PathFinder @@ -232,3 +233,25 @@ def export_whoami(self): # Not serializable del credDict["x509Chain"] return S_OK(credDict) + + auth_sleep = ["authenticated"] + + def export_sleep(self, sleepTime): + """ + A simple sleep, returns all credential dictionary, except certificate chain object. + """ + sleep(sleepTime) + return S_OK(sleepTime) + + auth_dbSleep = ["all"] + + def export_dbSleep(self, sleepTime): + """ + A simple sleep + """ + try: + dbInst = [getattr(self, attr) for attr in dir(self)][0] + dbInst._query(f"SELECT 'IN DB', SLEEP({sleepTime})") + return S_OK(sleepTime) + except Exception as e: + return S_ERROR(f"Issue doing DB sleep {e!r}")