-
Notifications
You must be signed in to change notification settings - Fork 79
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Added code related to bot specific executor logs. Added and fixed test cases related to the same. * Added code related to bot specific executor logs. Added and fixed test cases related to the same. * Added code related to bot specific executor logs. Added and fixed test cases related to the same. * changed tests according to code rabbit suggestions.
- Loading branch information
1 parent
936930c
commit 8203cc5
Showing
12 changed files
with
905 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
from kairon.shared.events.data_objects import ExecutorLogs | ||
|
||
|
||
class ExecutorProcessor: | ||
|
||
@staticmethod | ||
def get_executor_logs(bot: str, start_idx: int = 0, page_size: int = 10, **kwargs): | ||
""" | ||
Get all executor logs data . | ||
@param bot: bot id. | ||
@param start_idx: start index | ||
@param page_size: page size | ||
@return: list of logs. | ||
""" | ||
event_class = kwargs.get("event_class") | ||
task_type = kwargs.get("task_type") | ||
query = {"bot": bot} | ||
if event_class: | ||
query.update({"event_class": event_class}) | ||
if task_type: | ||
query.update({"task_type": task_type}) | ||
for log in ExecutorLogs.objects(**query).order_by("-timestamp").skip(start_idx).limit(page_size): | ||
executor_logs = log.to_mongo().to_dict() | ||
executor_logs.pop('_id') | ||
yield executor_logs | ||
|
||
@staticmethod | ||
def get_row_count(bot: str, **kwargs): | ||
""" | ||
Gets the count of rows in a ExecutorLogs for a particular bot. | ||
:param bot: bot id | ||
:return: Count of rows | ||
""" | ||
event_class = kwargs.get("event_class") | ||
task_type = kwargs.get("task_type") | ||
query = {"bot": bot} | ||
if event_class: | ||
query.update({"event_class": event_class}) | ||
if task_type: | ||
query.update({"task_type": task_type}) | ||
return ExecutorLogs.objects(**query).count() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.