Skip to content

Commit

Permalink
clean leftovers
Browse files Browse the repository at this point in the history
  • Loading branch information
VladimirFilonov committed Dec 2, 2024
1 parent dec8598 commit f0cc1db
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 26 deletions.
21 changes: 0 additions & 21 deletions keep/api/models/db/alert.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,6 @@ class AlertToIncident(SQLModel, table=True):
primary_key=True,
)
)
# alert: "Alert" = Relationship(back_populates="alert_to_incident_link")
# incident: "Incident" = Relationship(back_populates="alert_to_incident_link")

is_created_by_ai: bool = Field(default=False)

Expand Down Expand Up @@ -111,20 +109,6 @@ class LastAlertToIncident(SQLModel, table=True):
)


# alert: "Alert" = Relationship(
# back_populates="alert_to_incident_link",
# sa_relationship = relationship(
# "Alert",
# secondary="lastalert",
# primaryjoin=f"""LastAlertToIncident.fingerprint == LastAlert.fingerprint""",
# secondaryjoin="LastAlert.alert_id == Alert.id",
# overlaps="alert,lastalert",
# viewonly=True,
# ),
# )
# incident: "Incident" = Relationship(back_populates="alert_to_incident_link")


class Incident(SQLModel, table=True):
id: UUID = Field(default_factory=uuid4, primary_key=True)
tenant_id: str = Field(foreign_key="tenant.id")
Expand All @@ -148,11 +132,6 @@ class Incident(SQLModel, table=True):
end_time: datetime | None
last_seen_time: datetime | None

# alert_to_incident_link: List[LastAlertToIncident] = Relationship(
# back_populates="incident",
# sa_relationship_kwargs={"overlaps": "alerts,incidents"},
# )

is_predicted: bool = Field(default=False)
is_confirmed: bool = Field(default=False)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""New types for AI config
Revision ID: 3ad5308e7200
Revises: 192157fd5788
Revises: 3f056d747d9e
Create Date: 2024-12-01 16:40:12.655642
"""
Expand Down
4 changes: 0 additions & 4 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
from sqlmodel import SQLModel, Session, create_engine
from starlette_context import context, request_cycle_context

from keep.api.core.db import set_last_alert
# This import is required to create the tables
from keep.api.core.dependencies import SINGLE_TENANT_UUID
from keep.api.core.elastic import ElasticClient
Expand Down Expand Up @@ -587,10 +586,7 @@ def setup_stress_alerts(
num_alerts = request.param.get(
"num_alerts", 1000
) # Default to 1000 alerts if not specified
start_time = time.time()
alerts = setup_stress_alerts_no_elastic(num_alerts)
print(f"time taken to setup {num_alerts} alerts with db: ", time.time() - start_time)

# add all to elasticsearch
alerts_dto = convert_db_alerts_to_dto_alerts(alerts)
elastic_client.index_alerts(alerts_dto)
Expand Down

0 comments on commit f0cc1db

Please sign in to comment.