Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Batch acquire: take up to N tasks per call across non-empty queues

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

Maintainer thường phản hồi trong vòng 1 ngày

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

Đánh giá

Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức phù hợp với người mới
30/100
Loại issue
Tính năng
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
python, redis

Hướng nghiên cứu

Trước tiên, hãy đọc threadmill/backends/redis.py và acquire.lua, sau đó theo dõi WorkerProcess và WorkerThread để hiểu luồng acquire hiện tại theo từng thread. Xác định cách fetch-and-dispatch xử lý thời điểm của lease, việc tắt máy một cách graceful và các task được tải trước, đồng thời giữ pop và move trong một lần gọi script. Hoàn thành khi có thể acquire tối đa N task trên các queue không rỗng mà không có công việc nào bị bỏ lại hoặc thất bại sớm.

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

Mô tả

Split out of #48 during the fair multi-queue scheduling change (codingjoe-fair-multi-queue-scheduling).

defer: Batch acquire (fetch up to N tasks per call across non-empty queues). Needs executor fetch-and-dispatch; the lease would tick while tasks wait in-process. [threadmill/backends/redis.py]

Why

acquire() pops a single task per script call, so a process with --threads 4 performs four Redis round trips to fill its threads. A batch acquire that spreads up to N tasks across the non-empty queues would cut round trips and drain several queues in parallel.

What makes it non-trivial

  • WorkerProcess runs one WorkerThread per thread, each calling acquire() itself. A batch would need a fetch-and-dispatch step, since a single thread cannot execute N tasks at once.
  • acquire.lua moves the task into the running set with deadline = now + lease_ttl. Tasks prefetched into an in-process queue would burn lease budget while waiting, so the reaper could fail them, or the lease clock has to start at execution instead.
  • Graceful shutdown must return prefetched, unstarted tasks to the ready set instead of leaving them to be reaped as FAILED.

Pop and move must stay inside one script call.

Ngôn ngữ chính
Python
Star
17
Fork
1
Merge trung bình
2 giờ 47 phút
Pull request đã merge (30 ngày)
13

Chuẩn bị môi trường

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.

Issue khác của codingjoe/threadmill

Tất cả issue của codingjoe/threadmill

Issue tương tự

Thêm issue về Python

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.