Skip to content

Commit

Permalink
fix: iterated experiment logging
Browse files Browse the repository at this point in the history
  • Loading branch information
gmega committed Jan 27, 2025
1 parent ba1b93d commit ae678bc
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions benchmarks/logging/logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,14 +203,17 @@ def __exit__(self, exc_type, exc_val, exc_tb):


class Event(LogEntry):
node: NodeId
name: str # XXX this ends up being redundant for custom event schemas... need to think of a better solution.
timestamp: datetime.datetime = Field(
default_factory=lambda: datetime.datetime.now(datetime.UTC)
)


class Metric(Event):
class NodeEvent(Event):
node: NodeId


class Metric(NodeEvent):
value: int | float


Expand All @@ -219,14 +222,13 @@ class RequestEventType(Enum):
end = "end"


class RequestEvent(Event):
class RequestEvent(NodeEvent):
destination: NodeId
request_id: str
type: RequestEventType


class ExperimentStatus(Event):
name: str
repetition: int
duration: float
error: Optional[str] = None
Expand All @@ -236,6 +238,7 @@ def basic_log_parser() -> LogParser:
"""Constructs a basic log parser which can understand some common log entry types."""
parser = LogParser()
parser.register(Event)
parser.register(NodeEvent)
parser.register(Metric)
parser.register(RequestEvent)
parser.register(ExperimentStatus)
Expand Down

0 comments on commit ae678bc

Please sign in to comment.