diff --git a/artiq/examples/master/repository/flopping_f_simulation.py b/artiq/examples/master/repository/flopping_f_simulation.py index d6e875be7..1af331999 100644 --- a/artiq/examples/master/repository/flopping_f_simulation.py +++ b/artiq/examples/master/repository/flopping_f_simulation.py @@ -52,8 +52,7 @@ class FloppingF(EnvExperiment): self.mutate_dataset("flopping_f_frequency", i, f) self.mutate_dataset("flopping_f_brightness", i, m_brightness) time.sleep(0.1) - self.scheduler.submit(self.scheduler.pipeline_name, self.scheduler.expid, - self.scheduler.priority, time.time() + 20, False) + self.scheduler.submit(due_date=time.time() + 20) def analyze(self): # Use get_dataset so that analyze can be run stand-alone. diff --git a/artiq/frontend/artiq_run.py b/artiq/frontend/artiq_run.py index 94e853edc..4972a5cd7 100755 --- a/artiq/frontend/artiq_run.py +++ b/artiq/frontend/artiq_run.py @@ -95,7 +95,7 @@ class DummyScheduler: self._next_rid = 1 - def submit(self, pipeline_name, expid, priority, due_date, flush): + def submit(self, pipeline_name=None, expid=None, priority=None, due_date=None, flush=False): rid = self._next_rid self._next_rid += 1 logger.info("Submitting: %s, RID=%s", expid, rid) diff --git a/artiq/master/scheduler.py b/artiq/master/scheduler.py index 842fda853..53d06cac9 100644 --- a/artiq/master/scheduler.py +++ b/artiq/master/scheduler.py @@ -402,8 +402,12 @@ class Scheduler: if self._pipelines: logger.warning("some pipelines were not garbage-collected") - def submit(self, pipeline_name, expid, priority, due_date, flush): - """Submits a new run.""" + def submit(self, pipeline_name, expid, priority=0, due_date=None, flush=False): + """Submits a new run. + + When called through an experiment, the default values of + ``pipeline_name``, ``expid`` and ``priority`` correspond to those of + the current run.""" # mutates expid to insert head repository revision if None if self._terminated: return diff --git a/artiq/master/worker_impl.py b/artiq/master/worker_impl.py index 3c4003a21..0c99c5238 100644 --- a/artiq/master/worker_impl.py +++ b/artiq/master/worker_impl.py @@ -79,32 +79,39 @@ set_watchdog_factory(Watchdog) class Scheduler: - pause_noexc = staticmethod(make_parent_action("pause")) - - @host_only - def pause(self): - if self.pause_noexc(): - raise TerminationRequested - - submit = staticmethod(make_parent_action("scheduler_submit")) - delete = staticmethod(make_parent_action("scheduler_delete")) - request_termination = staticmethod( - make_parent_action("scheduler_request_termination")) - get_status = staticmethod(make_parent_action("scheduler_get_status")) - def set_run_info(self, rid, pipeline_name, expid, priority): self.rid = rid self.pipeline_name = pipeline_name self.expid = expid self.priority = priority - _check_pause = staticmethod(make_parent_action("scheduler_check_pause")) + pause_noexc = staticmethod(make_parent_action("pause")) + @host_only + def pause(self): + if self.pause_noexc(): + raise TerminationRequested + _check_pause = staticmethod(make_parent_action("scheduler_check_pause")) def check_pause(self, rid=None) -> TBool: if rid is None: rid = self.rid return self._check_pause(rid) + _submit = staticmethod(make_parent_action("scheduler_submit")) + def submit(self, pipeline_name=None, expid=None, priority=None, due_date=None, flush=False): + if pipeline_name is None: + pipeline_name = self.pipeline_name + if expid is None: + expid = self.expid + if priority is None: + priority = self.priority + return self._submit(pipeline_name, expid, priority, due_date, flush) + + delete = staticmethod(make_parent_action("scheduler_delete")) + request_termination = staticmethod( + make_parent_action("scheduler_request_termination")) + get_status = staticmethod(make_parent_action("scheduler_get_status")) + class CCB: issue = staticmethod(make_parent_action("ccb_issue"))