From c80f0fa07a4032a4798684de8762f208ed6642ee Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Sat, 8 Aug 2015 11:44:19 +0800 Subject: [PATCH] master: delete head repository checkout on exit --- artiq/frontend/artiq_master.py | 1 + artiq/master/repository.py | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/artiq/frontend/artiq_master.py b/artiq/frontend/artiq_master.py index b63c52a2e..2d6fffd18 100755 --- a/artiq/frontend/artiq_master.py +++ b/artiq/frontend/artiq_master.py @@ -74,6 +74,7 @@ def main(): else: repo_backend = FilesystemBackend(args.repository) repository = Repository(repo_backend, log.log) + atexit.register(repository.close) repository.scan_async() worker_handlers = { diff --git a/artiq/master/repository.py b/artiq/master/repository.py index 71eff04e1..73ff9cde0 100644 --- a/artiq/master/repository.py +++ b/artiq/master/repository.py @@ -63,6 +63,10 @@ class Repository: self._scanning = False + def close(self): + # The object cannot be used anymore after calling this method. + self.backend.release_rev(self.head_rev) + @asyncio.coroutine def scan(self): if self._scanning: