Skip to content

Commit

Permalink
debug segfault
Browse files Browse the repository at this point in the history
  • Loading branch information
chaen committed Dec 4, 2023
1 parent 94a4af9 commit c3281a4
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 2 deletions.
26 changes: 25 additions & 1 deletion src/DIRAC/Core/DISET/RequestHandler.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
25 changes: 24 additions & 1 deletion src/DIRAC/Core/Tornado/Server/TornadoService.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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}")

0 comments on commit c3281a4

Please sign in to comment.