Files
3cloud-backend/websocket_server/models.py
T

27 lines
962 B
Python
Raw Normal View History

2025-06-17 13:20:44 +09:30
# websocket_server/models.py
from sqlalchemy import Column, Integer, String, Text, DateTime, Float
from websocket_server.config import Base, engine
from datetime import datetime
class Task(Base):
__tablename__ = "tasks"
id = Column(Integer, primary_key=True)
worker_id = Column(String(64), index=True)
job_details = Column(Text)
response = Column(Text)
status = Column(Text)
success = Column(Text)
creation_time = Column(DateTime, default=datetime.utcnow)
start_time = Column(DateTime, nullable=True)
finish_time = Column(DateTime, nullable=True)
wait_time = Column(Float, nullable=True)
execution_time = Column(Float, nullable=True)
task_type = Column(String(50), nullable=False)
depends_on = Column(Integer, nullable=True) # ID of the task this task depends on
not_before = Column(DateTime, nullable=True) # Earliest time this task can run
# Create tables
Base.metadata.create_all(bind=engine)