Refactor job model and optimize job streaming.
Updated the `JobModel` with foreign key relationships and string-based status to enhance database consistency, and improved job event streaming by using `jsonable_encoder` for better serialization. Also, streamlined dependencies by adding `urllib3` to handle HTTP requests.
This commit is contained in:
@ -7,7 +7,6 @@ from sqlalchemy import (
|
||||
JSON,
|
||||
DateTime,
|
||||
Boolean,
|
||||
Enum,
|
||||
func,
|
||||
)
|
||||
from sqlalchemy.orm import relationship
|
||||
@ -318,8 +317,8 @@ class Jobs(Base):
|
||||
__tablename__ = "jobs"
|
||||
|
||||
id = Column(Integer, primary_key=True, index=True)
|
||||
experiment_parameters_id = Column(Integer, nullable=False)
|
||||
status = Column(Enum(JobStatus), default=JobStatus.TODO, nullable=False)
|
||||
parameters = Column(JSON, nullable=False)
|
||||
experiment_parameters_id = Column(Integer, ForeignKey("experiment_parameters.id"))
|
||||
status = Column(String, nullable=False)
|
||||
parameters = relationship(ExperimentParameters)
|
||||
created_at = Column(DateTime, server_default=func.now())
|
||||
updated_at = Column(DateTime, onupdate=func.now())
|
||||
|
Reference in New Issue
Block a user