forked from M-Labs/artiq
master: publish repository status
This commit is contained in:
parent
fb8a5486e3
commit
4bf0db32be
|
@ -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(
|
||||
|
|
|
@ -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(
|
||||
|
|
Loading…
Reference in New Issue