ProjectTech4DevAI / ProjectTech4DevAI/kaapi-backend

Async Job: Foreign Key Association for Project and Organization

Đang mở
#552 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Ngôn ngữ chính
Python
Star
18
Fork
10
Merge trung bình
2 ngày 20 giờ
Pull request đã merge (30 ngày)
14

Mô tả

Describe the current behavior
Async "Job" database model does not have project_id and organization_id FK relation

Describe the enhancement you'd like
Add these relations or use batch_job table for both the celery async job and other batch job status

Why is this enhancement needed?
From a maintainability perspective

Additional context

class Job(SQLModel, table=True):
    """Database model for tracking async jobs."""

    __tablename__ = "job"

    id: UUID = Field(
        default_factory=uuid4,
        primary_key=True,
        sa_column_kwargs={"comment": "Unique identifier for the job"},
    )
    task_id: str | None = Field(
        nullable=True,
        description="Celery task ID returned when job is queued.",
        sa_column_kwargs={"comment": "Celery task ID returned when job is queued"},
    )
    trace_id: str | None = Field(
        default=None,
        description="Tracing ID for correlating logs and traces.",
        sa_column_kwargs={"comment": "Tracing ID for correlating logs and traces"},
    )
    error_message: str | None = Field(
        default=None,
        description="Error details if the job fails.",
        sa_column_kwargs={"comment": "Error details if the job fails"},
    )
    status: JobStatus = Field(
        default=JobStatus.PENDING,
        description="Current state of the job.",
        sa_column_kwargs={
            "comment": "Current state of the job (PENDING, PROCESSING, SUCCESS, FAILED)"
        },
    )
    job_type: JobType = Field(
        description="Type of job being executed (e.g., response, ingestion).",
        sa_column_kwargs={
            "comment": "Type of job being executed (e.g., RESPONSE, LLM_API)"
        },
    )

    # Timestamps
    created_at: datetime = Field(
        default_factory=now,
        sa_column_kwargs={"comment": "Timestamp when the job was created"},
    )
    updated_at: datetime = Field(
        default_factory=now,
        sa_column_kwargs={"comment": "Timestamp when the job was last updated"},
    )

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Hướng nghiên cứu

Bắt đầu bằng cách xác định định nghĩa Job của SQLModel và các model hoặc bảng hiện có project, organizationbatch_job. So sánh xem job bất đồng bộ nên nhận cả hai quan hệ khóa ngoại hay dùng chung batch_job, sau đó kiểm tra các quy ước liên quan về schema và migration. Được coi là hoàn tất khi thiết kế được chọn duy trì các liên kết bắt buộc mà không nhân đôi các model trạng thái job.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
python
Lĩnh vực
backend, databases
Loại issue
Tính năng
Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Cần làm rõ
Mức phù hợp với người mới
35/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.