Jobs: with keep_completed, success and error records outlive the rows they describe
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ó
- 3/5
- Thời gian dự kiến
- Nửa ngày
- Mức phù hợp với người mới
- 65/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- mysql, python
- Lĩnh vực
- data-engineering, databases
Hướng nghiên cứu
Start from Job.refresh(), specifically step 3, which removes stale job records only when they are older than stale_timeout and their keys are missing from key_source. Run the reproduction in the issue to see that success rows for deleted keys survive refresh(stale_timeout=0). Done means those orphaned success and error rows are removed without waiting for the timeout, while pending rows keep the age check. The issue also offers an alternative change to the meaning of stale_timeout=0, so check with maintainers which one they want.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Summary
With config.jobs.keep_completed = True, a table's jobs table keeps a success record for every computed key. When upstream rows are deleted and the cascade removes the computed rows, their success records stay. jobs.refresh() does not remove them until they are older than stale_timeout (3600 s by default). Passing stale_timeout=0 skips the cleanup entirely instead of forcing it. For up to an hour, then, status counts read from the jobs table overstate what the table holds. Records with status='error' for keys that no longer exist behave the same way.
Reproduction
DataJoint 2.3.5.dev2 (master), MySQL 8.0:
import datajoint as dj
dj.config.jobs.keep_completed = True
schema = dj.Schema("scratch_jobs")
@schema
class Raw(dj.Manual):
definition = """
raw_id : int32
---
v : float32
"""
@schema
class Proc(dj.Computed):
definition = """
-> Raw
---
w : float32
"""
def make(self, key):
self.insert1(dict(key, w=2 * (Raw & key).fetch1("v")))
def counts():
j = Proc.jobs
return {s: len(j & f"status='{s}'") for s in ("pending", "reserved", "success", "error")}
Raw.insert([dict(raw_id=i, v=float(i)) for i in range(3)])
Proc.populate(reserve_jobs=True)
print("after populate:", "rows", len(Proc()), "jobs", counts())
(Raw & "raw_id = 0").delete(prompt=False)
print("after deleting raw_id=0:", "rows", len(Proc()), "key_source", len(Proc.key_source), "jobs", counts())
print("refresh:", Proc.jobs.refresh())
print("refresh(stale_timeout=0):", Proc.jobs.refresh(stale_timeout=0), "jobs", counts())
Output:
after populate: rows 3 jobs {'pending': 0, 'reserved': 0, 'success': 3, 'error': 0}
after deleting raw_id=0: rows 2 key_source 2 jobs {'pending': 0, 'reserved': 0, 'success': 3, 'error': 0}
refresh: {'added': 0, 'removed': 0, 'orphaned': 0, 're_pended': 0}
refresh(stale_timeout=0): {'added': 0, 'removed': 0, 'orphaned': 0, 're_pended': 0} jobs {'pending': 0, 'reserved': 0, 'success': 3, 'error': 0}
Two rows exist and three successes are recorded. After a larger delete (removing a parameter set, say), anything that reports progress from the jobs table shows completed work that no longer exists, for an hour.
Where it comes from
Job.refresh() step 3 removes only records older than stale_timeout whose keys are no longer in key_source. The age condition makes sense for pending records, which can race a key_source that is still being filled, and the setting's description says so: "Seconds before pending job is checked for staleness". It is applied to every status except ignore, though, including success and error. And stale_timeout=0 means "skip this step", so there is no way to request the cleanup now.
Proposal
In refresh(), remove success and error records whose keys are in neither key_source nor the target, regardless of age. Keep the age condition for pending, which it was written for. Neither kind of record describes anything that exists, and neither is retried. Alternatively, make stale_timeout=0 mean "no grace period" rather than "skip", and give the skip its own value (None).
- Ngôn ngữ chính
- Python
- Star
- 197
- Fork
- 98
- Merge trung bình
- 15 giờ 31 phút
- Pull request đã merge (30 ngày)
- 9
Chuẩn bị môi trường
- Có Dockerfile hoặc tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của datajoint/datajoint-python
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
datajoint/datajoint-python#1581 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
datajoint/datajoint-python#1539 · 3 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
_job_start_time records the populating host's local time, with no zoneCó thể đã có người làm @dimitri-yatsenko đã nhận 1 ngày trước. Đang mở
datajoint/datajoint-python#1584 · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
database.name should namespace schema names on MySQL, as it does on PostgreSQLCó thể đã có người làm @dimitri-yatsenko đã nhận 3 ngày trước. Đang mởfeature
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 15/100
datajoint/datajoint-python#1582 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 40/100
datajoint/datajoint-python#1580 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của datajoint/datajoint-python
Issue tương tự
-
effort: low prio: low ready
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
digitalfabrik/integreat-cms#4616 ·
Maintainer thường phản hồi trong vòng 5 ngày
-
bug difficulty:2 good first issue help wanted
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
MakazhanAlpamys/Soup#1865 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
FinanceFlash/unvibecode#233 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
area: agents area: docs good first issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
openapi/gknowledge#23 ·
-
useless-suppression reported for deprecated-* messages that should be exemptCó thể đã có người làm @adityasinha-ghub đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
pylint-dev/pylint#11656 ·
Maintainer thường phản hồi trong vòng 1 ngày