Refactor MonitorService class and add delete_vertex_builds method
This commit is contained in:
parent
a735289476
commit
92ba9562b3
1 changed files with 10 additions and 3 deletions
|
|
@ -3,12 +3,11 @@ from pathlib import Path
|
||||||
from typing import TYPE_CHECKING, Optional
|
from typing import TYPE_CHECKING, Optional
|
||||||
|
|
||||||
import duckdb
|
import duckdb
|
||||||
from loguru import logger
|
|
||||||
from platformdirs import user_cache_dir
|
|
||||||
|
|
||||||
from langflow.services.base import Service
|
from langflow.services.base import Service
|
||||||
from langflow.services.monitor.schema import MessageModel, TransactionModel, VertexBuildModel
|
from langflow.services.monitor.schema import MessageModel, TransactionModel, VertexBuildModel
|
||||||
from langflow.services.monitor.utils import add_row_to_table, drop_and_create_table_if_schema_mismatch
|
from langflow.services.monitor.utils import add_row_to_table, drop_and_create_table_if_schema_mismatch
|
||||||
|
from loguru import logger
|
||||||
|
from platformdirs import user_cache_dir
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from langflow.services.settings.manager import SettingsService
|
from langflow.services.settings.manager import SettingsService
|
||||||
|
|
@ -85,6 +84,14 @@ class MonitorService(Service):
|
||||||
|
|
||||||
return df.to_dict(orient="records")
|
return df.to_dict(orient="records")
|
||||||
|
|
||||||
|
def delete_vertex_builds(self, flow_id: Optional[str] = None):
|
||||||
|
query = "DELETE FROM vertex_builds"
|
||||||
|
if flow_id:
|
||||||
|
query += f" WHERE flow_id = '{flow_id}'"
|
||||||
|
|
||||||
|
with duckdb.connect(str(self.db_path)) as conn:
|
||||||
|
conn.execute(query)
|
||||||
|
|
||||||
def get_messages(
|
def get_messages(
|
||||||
self,
|
self,
|
||||||
sender_type: Optional[str] = None,
|
sender_type: Optional[str] = None,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue