-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathszdiagnostic.py
129 lines (94 loc) · 3.73 KB
/
szdiagnostic.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
#! /usr/bin/env python3
"""
szdiagnostic.py is the abstract class for all implementations of SzDiagnostic.
"""
from abc import ABC, abstractmethod
from .szhelpers import construct_help
# Metadata
__all__ = ["SzDiagnostic"]
__version__ = "0.0.1" # See https://www.python.org/dev/peps/pep-0396/
__date__ = "2023-10-30"
__updated__ = "2025-01-28"
# -----------------------------------------------------------------------------
# SzDiagnostic
# -----------------------------------------------------------------------------
class SzDiagnostic(ABC):
"""
Senzing diagnostic module access library
"""
# -------------------------------------------------------------------------
# Interface definition
# -------------------------------------------------------------------------
@abstractmethod
def check_datastore_performance(self, seconds_to_run: int) -> str:
"""
The `check_datastore_performance` method performs inserts to determine rate of insertion.
Args:
seconds_to_run (int): Duration of the test in seconds.
Returns:
str: A string containing a JSON document.
Raises:
TypeError: Incorrect datatype of input parameter.
szexception.SzError:
.. collapse:: Example:
.. literalinclude:: ../../examples/szdiagnostic/check_datastore_performance.py
:linenos:
:language: python
**Output:**
.. literalinclude:: ../../examples/szdiagnostic/check_datastore_performance.txt
:linenos:
:language: json
"""
@abstractmethod
def get_datastore_info(self) -> str:
"""
The `get_datastore_info` method returns a JSON document with details of the datastore
currently in use by Senzing.
Raises:
szexception.SzError:
.. collapse:: Example:
.. literalinclude:: ../../examples/szdiagnostic/get_datastore_info.py
:linenos:
:language: python
**Output:**
.. literalinclude:: ../../examples/szdiagnostic/get_datastore_info.txt
:linenos:
:language: json
"""
# NOTE This is included but not to be documented
@abstractmethod
def get_feature(self, feature_id: int) -> str:
"""
**Warning:**
The `get_feature` method is an experimental method that returns diagnostic information of a feature.
Not recommended for use.
Args:
feature_id (int): The identifier of the feature to describe.
Returns:
str: A string containing a JSON document
"""
@abstractmethod
def purge_repository(self) -> None:
"""
**Warning:**
The `purge_repository` method removes every record in the Senzing repository.
Before calling `purge_repository` all other instances of the Senzing API
MUST be destroyed or shutdown.
Raises:
.. collapse:: Example:
.. literalinclude:: ../../examples/szdiagnostic/purge_repository.py
:linenos:
:language: python
"""
# -------------------------------------------------------------------------
# Convenience methods
# -------------------------------------------------------------------------
def help(self, method_name: str = "") -> str:
"""
Return the help for a particular message.
Args:
method_name (str): The name of the method. (e.g. "init"). If empty, a list of methods and descriptions is returned.
Returns:
str: The Help information about the requested method
"""
return construct_help(self, method_name=method_name)