From 4bf0db32be75d2b68003aa2b021fd6c3d7b99ca1 Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Fri, 18 Mar 2016 00:40:17 +0800 Subject: [PATCH] master: publish repository status --- artiq/frontend/artiq_master.py | 1 + artiq/master/experiments.py | 9 ++++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/artiq/frontend/artiq_master.py b/artiq/frontend/artiq_master.py index 1d8c55cc0..1d3a8617e 100755 --- a/artiq/frontend/artiq_master.py +++ b/artiq/frontend/artiq_master.py @@ -105,6 +105,7 @@ def main(): "devices": device_db.data, "datasets": dataset_db.data, "explist": experiment_db.explist, + "explist_status": experiment_db.status, "log": log_buffer.data }) loop.run_until_complete(server_notify.start( diff --git a/artiq/master/experiments.py b/artiq/master/experiments.py index f9f113210..866351f43 100644 --- a/artiq/master/experiments.py +++ b/artiq/master/experiments.py @@ -84,9 +84,13 @@ class ExperimentDB: self.cur_rev = self.repo_backend.get_head_rev() self.repo_backend.request_rev(self.cur_rev) self.explist = Notifier(dict()) - self._scanning = False + self.status = Notifier({ + "scanning": False, + "cur_rev": self.cur_rev + }) + def close(self): # The object cannot be used anymore after calling this method. self.repo_backend.release_rev(self.cur_rev) @@ -95,17 +99,20 @@ class ExperimentDB: if self._scanning: return self._scanning = True + self.status["scanning"] = True try: if new_cur_rev is None: new_cur_rev = self.repo_backend.get_head_rev() wd, _ = self.repo_backend.request_rev(new_cur_rev) self.repo_backend.release_rev(self.cur_rev) self.cur_rev = new_cur_rev + self.status["cur_rev"] = new_cur_rev new_explist = await _scan_experiments(wd, self.get_device_db_fn) _sync_explist(self.explist, new_explist) finally: self._scanning = False + self.status["scanning"] = False def scan_repository_async(self, new_cur_rev=None): asyncio.ensure_future(