Prevent two exports to the same archive path
Maintainer antworten meist innerhalb von 1 Tag
@ArpitaSamanta10 arbeitet bereits daran.
Seit 19.11.2026.
Bewertung
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Anfängerfreundlichkeit
- 68/100
- Issue-Typ
- Feature
- Klarheit
- Klar beschrieben
- Aktivitätsstatus
- Aktiv
- Tech-Stack
- python
- Bereich
- backend, distributed-systems
Rechercherichtung
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.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
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.
- Vorherrschende Sprache
- Python
- Sterne
- 15
- Forks
- 27
- Ø Merge
- 6 T. 44 Min.
- Gemergte PRs (30 T.)
- 13
Entwicklungsumgebung
- Enthält ein Dockerfile oder eine Docker-Compose-Datei
- Hat eine Pull-Request-Vorlage
- Beitragsleitfaden lesen
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus learningequality/morango
-
Document disk export and deprecations in the changelogEvtl. wieder frei @ArpitaSamanta10 hat das vor 14 Tagen übernommen, und es ist kein Pull Request offen. OffenDEV: dev-ops DEV: distributions DOCS: developer
Schwierigkeit 1/5 1-3 Stunden Anfängerfreundlichkeit 78/100
learningequality/morango#387 · 2 Kommentare ·
Maintainer antworten meist innerhalb von 1 Tag
-
DEV: backend DEV: dev-ops TAG: unit tests
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 70/100
learningequality/morango#385 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 54/100
learningequality/morango#425 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 1/100
learningequality/morango#424 ·
Maintainer antworten meist innerhalb von 1 Tag
-
DEV: backend P2 - normal
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 35/100
learningequality/morango#416 · 2 Kommentare ·
Maintainer antworten meist innerhalb von 1 Tag
Alle Issues in learningequality/morango
Ähnliche Issues
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 76/100
Maintainer antworten meist innerhalb von 1 Tag
-
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"Evtl. vergeben @cestercian hat das heute übernommen. Offencomp/cli P2 type/bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 75/100
NousResearch/hermes-agent#162259 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
-
[request] gRpc/1.86.0Offenupstream update
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
conan-io/conan-center-index#31597 ·
Maintainer antworten meist innerhalb von 1 Tag
-
bug enhancement
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 90/100
AOSSIE-Org/PictoPy#1802 · 2 Kommentare ·
Maintainer antworten meist innerhalb von 3 Tagen
-
community-request
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
NVIDIA-NeMo/Run#727 ·
Maintainer antworten meist innerhalb von 1 Tag