Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions vm_supervisor/metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ class ExecutionRecord(Base):
__tablename__ = "records"

uuid = Column(String, primary_key=True)

execution_uuid = Column(String, nullable=False)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You recreate the DB on startup, right? Otherwise adding a column will crash.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed, the database would require a migration.

vm_hash = Column(String, nullable=False)

time_defined = Column(DateTime, nullable=False)
Expand Down
6 changes: 4 additions & 2 deletions vm_supervisor/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,8 @@ async def record_usage(self):
if pid_info and pid_info.get("process"):
await save_record(
ExecutionRecord(
uuid=str(self.uuid),
uuid=str(uuid.uuid4()),
execution_uuid=str(self.uuid),
vm_hash=self.vm_hash,
time_defined=self.times.defined_at,
time_prepared=self.times.prepared_at,
Expand All @@ -227,7 +228,8 @@ async def record_usage(self):
# and its metrics are not available anymore.
await save_record(
ExecutionRecord(
uuid=str(self.uuid),
uuid=str(uuid.uuid4()),
execution_uuid=str(self.uuid),
vm_hash=self.vm_hash,
time_defined=self.times.defined_at,
time_prepared=self.times.prepared_at,
Expand Down