mirror of
https://github.com/m-labs/artiq.git
synced 2024-12-25 11:18:27 +08:00
scheduler: default submission arguments, closes #577
This commit is contained in:
parent
0e41725e2d
commit
1908339d4e
@ -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.
|
||||
|
@ -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)
|
||||
|
@ -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
|
||||
|
@ -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"))
|
||||
|
Loading…
Reference in New Issue
Block a user