From 5e14afde3ec024ec755d4768635e0a63c0ef5b88 Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Sun, 6 Dec 2015 18:55:33 +0800 Subject: [PATCH] scheduler: use current (last scanned) repo revision instead of HEAD --- artiq/frontend/artiq_master.py | 2 +- artiq/gui/experiments.py | 2 +- artiq/master/scheduler.py | 21 +++++++++++---------- doc/manual/management_system.rst | 2 +- 4 files changed, 14 insertions(+), 13 deletions(-) diff --git a/artiq/frontend/artiq_master.py b/artiq/frontend/artiq_master.py index 2f138a27e..da421a4a3 100755 --- a/artiq/frontend/artiq_master.py +++ b/artiq/frontend/artiq_master.py @@ -83,7 +83,7 @@ def main(): "update_dataset": dataset_db.update, "log": log_worker } - scheduler = Scheduler(get_last_rid() + 1, worker_handlers, repo_backend) + scheduler = Scheduler(get_last_rid() + 1, worker_handlers, experiment_db) worker_handlers.update({ "scheduler_submit": scheduler.submit, "scheduler_delete": scheduler.delete, diff --git a/artiq/gui/experiments.py b/artiq/gui/experiments.py index af9e7c7eb..59326b780 100644 --- a/artiq/gui/experiments.py +++ b/artiq/gui/experiments.py @@ -301,7 +301,7 @@ class _ExperimentDock(dockarea.Dock): log_level.currentIndexChanged.connect(update_log_level) repo_rev = QtGui.QLineEdit() - repo_rev.setPlaceholderText("HEAD") + repo_rev.setPlaceholderText("current") repo_rev_label = QtGui.QLabel("Revision:") repo_rev_label.setToolTip("Experiment repository revision " "(commit ID) to use") diff --git a/artiq/master/scheduler.py b/artiq/master/scheduler.py index b0987d361..294c2364a 100644 --- a/artiq/master/scheduler.py +++ b/artiq/master/scheduler.py @@ -127,14 +127,14 @@ class RIDCounter: class RunPool: - def __init__(self, ridc, worker_handlers, notifier, repo_backend): + def __init__(self, ridc, worker_handlers, notifier, experiment_db): self.runs = dict() self.state_changed = Condition() self.ridc = ridc self.worker_handlers = worker_handlers self.notifier = notifier - self.repo_backend = repo_backend + self.experiment_db = experiment_db def submit(self, expid, priority, due_date, flush, pipeline_name): # mutates expid to insert head repository revision if None. @@ -142,8 +142,9 @@ class RunPool: rid = self.ridc.get() if "repo_rev" in expid: if expid["repo_rev"] is None: - expid["repo_rev"] = self.repo_backend.get_head_rev() - wd, repo_msg = self.repo_backend.request_rev(expid["repo_rev"]) + expid["repo_rev"] = self.experiment_db.cur_rev + wd, repo_msg = self.experiment_db.repo_backend.request_rev( + expid["repo_rev"]) else: wd, repo_msg = None, None run = Run(rid, pipeline_name, wd, expid, priority, due_date, flush, @@ -159,7 +160,7 @@ class RunPool: run = self.runs[rid] await run.close() if "repo_rev" in run.expid: - self.repo_backend.release_rev(run.expid["repo_rev"]) + self.experiment_db.repo_backend.release_rev(run.expid["repo_rev"]) del self.runs[rid] @@ -325,8 +326,8 @@ class AnalyzeStage(TaskObject): class Pipeline: - def __init__(self, ridc, deleter, worker_handlers, notifier, repo_backend): - self.pool = RunPool(ridc, worker_handlers, notifier, repo_backend) + def __init__(self, ridc, deleter, worker_handlers, notifier, experiment_db): + self.pool = RunPool(ridc, worker_handlers, notifier, experiment_db) self._prepare = PrepareStage(self.pool, deleter.delete) self._run = RunStage(self.pool, deleter.delete) self._analyze = AnalyzeStage(self.pool, deleter.delete) @@ -386,12 +387,12 @@ class Deleter(TaskObject): class Scheduler: - def __init__(self, next_rid, worker_handlers, repo_backend): + def __init__(self, next_rid, worker_handlers, experiment_db): self.notifier = Notifier(dict()) self._pipelines = dict() self._worker_handlers = worker_handlers - self._repo_backend = repo_backend + self._experiment_db = experiment_db self._terminated = False self._ridc = RIDCounter(next_rid) @@ -422,7 +423,7 @@ class Scheduler: logger.debug("creating pipeline '%s'", pipeline_name) pipeline = Pipeline(self._ridc, self._deleter, self._worker_handlers, self.notifier, - self._repo_backend) + self._experiment_db) self._pipelines[pipeline_name] = pipeline pipeline.start() return pipeline.pool.submit(expid, priority, due_date, flush, pipeline_name) diff --git a/doc/manual/management_system.rst b/doc/manual/management_system.rst index 84a471cce..224c4be3d 100644 --- a/doc/manual/management_system.rst +++ b/doc/manual/management_system.rst @@ -107,7 +107,7 @@ You may now run the master with the Git support enabled: :: Push commits containing experiments to the bare repository using e.g. Git over SSH, and the new experiments should automatically appear in the GUI. -.. note:: If you plan to run the ARTIQ system entirely on a single machine, you may also consider using a non-bare repository and the ``post-commit`` hook to trigger repository scans every time you commit changes (locally). The ARTIQ master never uses the repository's working directory, but only what is committed. More precisely, it fetches by default the last (atomically) completed commit at the time of experiment submission and checks it out in a temporary folder (which solves the problem of concurrent repository access). +.. note:: If you plan to run the ARTIQ system entirely on a single machine, you may also consider using a non-bare repository and the ``post-commit`` hook to trigger repository scans every time you commit changes (locally). The ARTIQ master never uses the repository's working directory, but only what is committed. More precisely, when scanning the repository, it fetches the last (atomically) completed commit at that time of repository scan and checks it out in a temporary folder. This commit ID is used by default when subsequently submitting experiments. There is one temporary folder by commit ID currently referenced in the system, so concurrently running experiments from different repository revisions is fully supported by the master. The GUI always runs experiments from the repository. The command-line client, by default, runs experiment from the raw filesystem (which is useful for iterating rapidly without creating many disorganized commits). If you want to use the repository instead, simply pass the ``-R`` option.