forked from M-Labs/artiq
master: add an argument to set an experiment subdirectory
Signed-off-by: Mingyu Fan <mingyufan@ucsb.edu>
This commit is contained in:
parent
35d21c98d3
commit
178a86bcda
@ -24,6 +24,8 @@ Highlights:
|
||||
- HVAMP_8CH 8 channel HV amplifier for Fastino / Zotino
|
||||
* ``artiq_ddb_template`` generates edge-counter keys that start with the key of the corresponding
|
||||
TTL device (e.g. ``"ttl_0_counter"`` for the edge counter on TTL device``"ttl_0"``)
|
||||
* ``artiq_master`` now has an ``--experiment-subdir`` option to scan only a subdirectory of the
|
||||
repository when building the list of experiments.
|
||||
|
||||
Breaking changes:
|
||||
|
||||
|
@ -50,6 +50,10 @@ def get_argparser():
|
||||
group.add_argument(
|
||||
"-r", "--repository", default="repository",
|
||||
help="path to the repository (default: '%(default)s')")
|
||||
group.add_argument(
|
||||
"--experiment-subdir", default="",
|
||||
help=("path to the experiment folder from the repository root "
|
||||
"(default: '%(default)s')"))
|
||||
|
||||
log_args(parser)
|
||||
|
||||
@ -104,7 +108,8 @@ def main():
|
||||
repo_backend = GitBackend(args.repository)
|
||||
else:
|
||||
repo_backend = FilesystemBackend(args.repository)
|
||||
experiment_db = ExperimentDB(repo_backend, worker_handlers)
|
||||
experiment_db = ExperimentDB(
|
||||
repo_backend, worker_handlers, args.experiment_subdir)
|
||||
atexit.register(experiment_db.close)
|
||||
|
||||
scheduler = Scheduler(RIDCounter(), worker_handlers, experiment_db)
|
||||
|
@ -74,19 +74,20 @@ class _RepoScanner:
|
||||
entry_dict.update(entries)
|
||||
return entry_dict
|
||||
|
||||
async def scan(self, root):
|
||||
async def scan(self, root, subdir=""):
|
||||
self.worker = Worker(self.worker_handlers)
|
||||
try:
|
||||
r = await self._scan(root)
|
||||
r = await self._scan(root, subdir)
|
||||
finally:
|
||||
await self.worker.close()
|
||||
return r
|
||||
|
||||
|
||||
class ExperimentDB:
|
||||
def __init__(self, repo_backend, worker_handlers):
|
||||
def __init__(self, repo_backend, worker_handlers, experiment_subdir=""):
|
||||
self.repo_backend = repo_backend
|
||||
self.worker_handlers = worker_handlers
|
||||
self.experiment_subdir = experiment_subdir
|
||||
|
||||
self.cur_rev = self.repo_backend.get_head_rev()
|
||||
self.repo_backend.request_rev(self.cur_rev)
|
||||
@ -115,7 +116,8 @@ class ExperimentDB:
|
||||
self.cur_rev = new_cur_rev
|
||||
self.status["cur_rev"] = new_cur_rev
|
||||
t1 = time.monotonic()
|
||||
new_explist = await _RepoScanner(self.worker_handlers).scan(wd)
|
||||
new_explist = await _RepoScanner(self.worker_handlers).scan(
|
||||
wd, self.experiment_subdir)
|
||||
logger.info("repository scan took %d seconds", time.monotonic()-t1)
|
||||
update_from_dict(self.explist, new_explist)
|
||||
finally:
|
||||
|
Loading…
Reference in New Issue
Block a user