Skip to content

Commit 0f0f98c

Browse files
committed
feat: added TornadoDataIntegrityHandler
1 parent c165c81 commit 0f0f98c

File tree

4 files changed

+44
-12
lines changed

4 files changed

+44
-12
lines changed

docs/source/AdministratorGuide/ServerInstallations/scalingAndLimitations.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ Services
7777
+--------------------+---------------------------------------------------------------------------------------------------+-------------+---------------------------------------------------------------------------+-----------+
7878
| Configuration | :mod:`Configuration <DIRAC.ConfigurationSystem.Service.ConfigurationHandler>` | PARTIAL | One master (rw) and slaves (ro). It's advised to have several CS slaves | YES +
7979
+--------------------+---------------------------------------------------------------------------------------------------+-------------+---------------------------------------------------------------------------+-----------+
80-
| DataManagement | :mod:`DataIntegrity <DIRAC.DataManagementSystem.Service.DataIntegrityHandler>` | YES | | +
80+
| DataManagement | :mod:`DataIntegrity <DIRAC.DataManagementSystem.Service.DataIntegrityHandler>` | YES | | YES +
8181
+ +---------------------------------------------------------------------------------------------------+-------------+---------------------------------------------------------------------------+-----------+
8282
| | :mod:`FileCatalog <DIRAC.DataManagementSystem.Service.FileCatalogHandler>` | YES | | YES +
8383
+ +---------------------------------------------------------------------------------------------------+-------------+---------------------------------------------------------------------------+-----------+

src/DIRAC/DataManagementSystem/ConfigTemplate.cfg

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,16 @@ Services
88
Default = authenticated
99
}
1010
}
11+
##BEGIN TornadoDataIntegrity
12+
TornadoDataIntegrity
13+
{
14+
Protocol = https
15+
Authorization
16+
{
17+
Default = authenticated
18+
}
19+
}
20+
##END
1121
##BEGIN FTS3Manager
1222
FTS3Manager
1323
{
@@ -76,7 +86,6 @@ Services
7686
Default = authenticated
7787
}
7888
}
79-
######################
8089

8190
##BEGIN StorageElement
8291
StorageElement

src/DIRAC/DataManagementSystem/Service/DataIntegrityHandler.py

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,13 @@
88
the DISET framework
99
1010
"""
11-
# imports
12-
import six
13-
1411
# from DIRAC
1512
from DIRAC import S_OK
1613
from DIRAC.Core.DISET.RequestHandler import RequestHandler
1714
from DIRAC.DataManagementSystem.DB.DataIntegrityDB import DataIntegrityDB
1815

1916

20-
class DataIntegrityHandler(RequestHandler):
17+
class DataIntegrityHandlerMixin:
2118
"""
2219
.. class:: DataIntegrityHandler
2320
@@ -31,7 +28,7 @@ def initializeHandler(cls, serviceInfoDict):
3128
cls.dataIntegrityDB = DataIntegrityDB()
3229
return S_OK()
3330

34-
types_removeProblematic = [list(six.integer_types) + [list]]
31+
types_removeProblematic = [[int, list]]
3532

3633
def export_removeProblematic(self, fileID):
3734
"""Remove the file with the supplied FileID from the database"""
@@ -57,7 +54,7 @@ def export_getProblematic(self):
5754
)
5855
return res
5956

60-
types_getPrognosisProblematics = [list(six.string_types)]
57+
types_getPrognosisProblematics = [str]
6158

6259
def export_getPrognosisProblematics(self, prognosis):
6360
"""Get problematic files from the problematics table of the IntegrityDB"""
@@ -69,7 +66,7 @@ def export_getPrognosisProblematics(self, prognosis):
6966
)
7067
return res
7168

72-
types_setProblematicStatus = [list(six.integer_types), list(six.string_types)]
69+
types_setProblematicStatus = [int, str]
7370

7471
def export_setProblematicStatus(self, fileID, status):
7572
"""Update the status of the problematics with the provided fileID"""
@@ -79,7 +76,7 @@ def export_setProblematicStatus(self, fileID, status):
7976
self.log.error("DataIntegrityHandler.setProblematicStatus: Failed to set status.", res["Message"])
8077
return res
8178

82-
types_incrementProblematicRetry = [list(six.integer_types)]
79+
types_incrementProblematicRetry = [int]
8380

8481
def export_incrementProblematicRetry(self, fileID):
8582
"""Update the retry count for supplied file ID."""
@@ -91,7 +88,7 @@ def export_incrementProblematicRetry(self, fileID):
9188
)
9289
return res
9390

94-
types_insertProblematic = [list(six.string_types), dict]
91+
types_insertProblematic = [str, dict]
9592

9693
def export_insertProblematic(self, source, fileMetadata):
9794
"""Insert problematic files into the problematics table of the IntegrityDB"""
@@ -111,7 +108,7 @@ def export_changeProblematicPrognosis(self, fileID, newPrognosis):
111108
self.log.error("DataIntegrityHandler.changeProblematicPrognosis: Failed to update.", res["Message"])
112109
return res
113110

114-
types_getTransformationProblematics = [list(six.integer_types)]
111+
types_getTransformationProblematics = [int]
115112

116113
def export_getTransformationProblematics(self, transID):
117114
"""Get the problematics for a given transformation"""
@@ -148,3 +145,7 @@ def export_getDistinctPrognosis(self):
148145
else:
149146
self.log.error("DataIntegrityHandler.getDistinctPrognosis: Failed to get unique prognosis.", res["Message"])
150147
return res
148+
149+
150+
class DataIntegrityHandler(DataIntegrityHandlerMixin, RequestHandler):
151+
pass
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
"""
2+
Service handler for DataIntegrity using https
3+
4+
.. literalinclude:: ../ConfigTemplate.cfg
5+
:start-after: ##BEGIN TornadoDataIntegrity
6+
:end-before: ##END
7+
:dedent: 2
8+
:caption: TornadoDataIntegrity options
9+
10+
"""
11+
12+
from DIRAC import gLogger
13+
from DIRAC.Core.Tornado.Server.TornadoService import TornadoService
14+
from DIRAC.DataManagementSystem.Service.DataIntegrityHandler import DataIntegrityHandlerMixin
15+
16+
sLog = gLogger.getSubLogger(__name__)
17+
18+
19+
class TornadoDataIntegrityHandler(DataIntegrityHandlerMixin, TornadoService):
20+
"""Tornado handler for the DataIntegrityHandler"""
21+
22+
log = sLog

0 commit comments

Comments
 (0)