Skip to content

Commit 87c02be

Browse files
committed
sqPoller eng: Populate statusStr instead of status
Signed-off-by: Dinesh Dutt <[email protected]>
1 parent 73659c6 commit 87c02be

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

suzieq/engines/pandas/sqPoller.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
from suzieq.shared.poller_error_codes import SqPollerStatusCode
12
from suzieq.engines.pandas.engineobj import SqPandasEngine
23

34

@@ -53,6 +54,9 @@ def get(self, **kwargs):
5354
if not df.empty and add_filter:
5455
df = df.query(add_filter).reset_index(drop=True)
5556

57+
if 'statusStr' in fields:
58+
df['statusStr'] = df.status.apply(self._get_status_str)
59+
5660
return df.reset_index(drop=True)[fields]
5761

5862
def summarize(self, **kwargs):
@@ -72,3 +76,12 @@ def summarize(self, **kwargs):
7276
]
7377

7478
return super().summarize(**kwargs)
79+
80+
@staticmethod
81+
def _get_status_str(code: int) -> str:
82+
'''Function to catch exception'''
83+
try:
84+
# pylint: disable=no-value-for-parameter
85+
return SqPollerStatusCode(code).errstr
86+
except ValueError:
87+
return f'{code}'

0 commit comments

Comments
 (0)