Prevent two exports to the same archive path
维护者通常 1 天内回复
@ArpitaSamanta10 已经在做这个了。
开始于 2026年11月19日。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 68/100
- Issue 类型
- 功能
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- python
调研方向
Start with morango/sync/archive.py and morango/errors.py, then read pid_exists in morango/utils.py and its use in morango/sync/syncsession.py. Add the lock and exception behavior described for create, finalize, and discard, and patch morango.sync.archive.pid_exists in tests. Done means the live/dead process cases, lock-file cleanup, error path, and Windows tox environment all pass.
由索引模型根据 Issue 内容生成。
描述
Overview
A lock file stops two processes from writing to the same archive path at the same time. This work is part of milestone M5.
Background & Motivation
Archive.create replaces a stale partial file. Without a lock, it cannot tell a stale file from a file that another export writes at the same time. A lock file that holds the process id solves this. Morango uses the same process check to resume sync sessions.
Design: spec. Plan: implementation plan, Task 18.
Description & Expected Outcomes
Archive.create makes <path>.lock with an exclusive create, and writes its process id into it. If the lock file exists and its process is alive, create raises MorangoArchiveLocked. If the process is not alive, the lock is stale, and create replaces it. finalize and discard delete the lock file.
Deliverables & Contracts
The change delivers these capabilities:
- The error
MorangoArchiveLocked, a subclass ofMorangoArchiveError. - Lock handling in
Archive.create,Archive.finalize, andArchive.discard. - An error message that names the lock file, so that an operator can remove it.
Acceptance Criteria
- A lock file with the id of a live process from another program makes
createraiseMorangoArchiveLocked. - A lock file with the id of a dead process is replaced, and
createsucceeds. - After
discard, no<path>.lockfile remains. - The error message contains the path of the lock file.
- The lock tests also run in the
windowstox environment.
Technical Pointers & Architecture
- Target Components / Context:
morango/sync/archive.py,morango/errors.py. - Related Patterns:
pid_existsinmorango/utils.py, used byresume_sync_sessionatmorango/sync/syncsession.py:304-312. - Data Model & Schema Considerations: None.
- Resilience & Failure Modes: If the operating system reuses a process id,
createcan report a false lock. The error message names the lock file for this case.
Notes & Tradeoffs
- Dependencies: Blocked by: #378 (
Archive.createanddiscard). Blocks: #382. - Testing Requirements: Patch
morango.sync.archive.pid_existsto control whether the process is alive. - Tradeoffs & Alternatives Considered: Operating system file locks do not work the same on all platforms. A lock file with a process id works on Linux, macOS, and Windows.
- Compatibility & Migrations: None.
Metadata
- Complexity: Low
- Target Branch: release-v0.9.x
AI Usage
Drafted with Claude (Claude Code) from the approved design spec and implementation plan. The author reviewed the requirements, and the code references were checked against the release-v0.9.x codebase.
- 主要语言
- Python
- 星标
- 15
- 派生
- 27
- 平均合并
- 6 天 44 分钟
- 30 天内合并 PR
- 13
环境准备
- 提供 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
learningequality/morango 的其他 Issue
-
Document disk export and deprecations in the changelog可能重新可做 @ArpitaSamanta10 于 14 天前认领,目前没有进行中的 PR。 未关闭DEV: dev-ops DEV: distributions DOCS: developer
难度 1/5 1-3 小时 新手友好度 78/100
learningequality/morango#387 · 2 条评论 ·
维护者通常 1 天内回复
-
DEV: backend DEV: dev-ops TAG: unit tests
难度 2/5 1-3 小时 新手友好度 70/100
learningequality/morango#385 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 54/100
learningequality/morango#425 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 1/100
learningequality/morango#424 ·
维护者通常 1 天内回复
-
DEV: backend P2 - normal
难度 4/5 3-5 天 新手友好度 35/100
learningequality/morango#416 · 2 条评论 ·
维护者通常 1 天内回复
查看 learningequality/morango 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 76/100
维护者通常 1 天内回复
-
hermes hooks doctor smoke test never checks the hook exit code — a crashing hook (exit=1) renders ✓ "ran clean" and "All shell hooks look healthy"可能已有人在做 @cestercian 今天认领。 未关闭comp/cli P2 type/bug
难度 2/5 1-3 小时 新手友好度 75/100
NousResearch/hermes-agent#162259 · 1 条评论 ·
维护者通常 1 天内回复
-
upstream update
难度 2/5 1-3 小时 新手友好度 72/100
conan-io/conan-center-index#31597 ·
维护者通常 1 天内回复
-
bug enhancement
难度 1/5 1 小时以内 新手友好度 90/100
AOSSIE-Org/PictoPy#1802 · 2 条评论 ·
维护者通常 3 天内回复
-
community-request
难度 2/5 1-3 小时 新手友好度 78/100
NVIDIA-NeMo/Run#727 ·
维护者通常 1 天内回复