Initial commit — PlantGuideScraper project
This commit is contained in:
27
backend/app/models/job.py
Normal file
27
backend/app/models/job.py
Normal file
@@ -0,0 +1,27 @@
|
||||
from sqlalchemy import Column, Integer, String, DateTime, Text, Boolean, func
|
||||
|
||||
from app.database import Base
|
||||
|
||||
|
||||
class Job(Base):
|
||||
__tablename__ = "jobs"
|
||||
|
||||
id = Column(Integer, primary_key=True, index=True)
|
||||
name = Column(String, nullable=False)
|
||||
source = Column(String, nullable=False)
|
||||
species_filter = Column(Text, nullable=True) # JSON array of species IDs or NULL for all
|
||||
only_without_images = Column(Boolean, default=False) # If True, only scrape species with 0 images
|
||||
max_images = Column(Integer, nullable=True) # If set, only scrape species with fewer than N images
|
||||
status = Column(String, default="pending", index=True) # pending, running, paused, completed, failed
|
||||
progress_current = Column(Integer, default=0)
|
||||
progress_total = Column(Integer, default=0)
|
||||
images_downloaded = Column(Integer, default=0)
|
||||
images_rejected = Column(Integer, default=0)
|
||||
celery_task_id = Column(String, nullable=True)
|
||||
started_at = Column(DateTime, nullable=True)
|
||||
completed_at = Column(DateTime, nullable=True)
|
||||
error_message = Column(Text, nullable=True)
|
||||
created_at = Column(DateTime, server_default=func.now())
|
||||
|
||||
def __repr__(self):
|
||||
return f"<Job(id={self.id}, name='{self.name}', status='{self.status}')>"
|
||||
Reference in New Issue
Block a user