Skip to content

Commit

Permalink
model id is relevant to analytics.
Browse files Browse the repository at this point in the history
  • Loading branch information
niklastheman committed Feb 12, 2025
1 parent 65f69a9 commit ec4b82a
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions fedn/network/storage/statestore/stores/analytic_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,12 @@


class Analytic:
def __init__(self, id: str, client_id: str, type: str, execution_duration: int, created_at: datetime):
def __init__(self, id: str, client_id: str, type: str, execution_duration: int, model_id: str, created_at: datetime):
self.id = id
self.client_id = client_id
self.type = type
self.execution_duration = execution_duration
self.model_id = model_id
self.created_at = created_at


Expand All @@ -25,7 +26,7 @@ def _validate_analytic(analytic: dict) -> Tuple[bool, str]:
return False, "client_id is required"
if "type" not in analytic or analytic["type"] not in ["training", "inference"]:
return False, "type must be either 'training' or 'inference'"
return analytic
return analytic, ""


def _complete_analytic(analytic: dict) -> dict:
Expand All @@ -48,6 +49,7 @@ def add(self, item: Analytic) -> Tuple[bool, Any]:
valid, msg = _validate_analytic(item)
if not valid:
return False, msg

_complete_analytic(item)

return super().add(item)
Expand Down

0 comments on commit ec4b82a

Please sign in to comment.