forked from M-Labs/artiq
scheduler: pass priority to experiments
This commit is contained in:
parent
e611e17eeb
commit
fc449509b8
@ -98,7 +98,8 @@ class Run:
|
||||
|
||||
@asyncio.coroutine
|
||||
def prepare(self):
|
||||
yield from self._prepare(self.rid, self.pipeline_name, self.expid)
|
||||
yield from self._prepare(self.rid, self.pipeline_name, self.expid,
|
||||
self.priority)
|
||||
|
||||
run = _mk_worker_method("run")
|
||||
resume = _mk_worker_method("resume")
|
||||
|
@ -202,14 +202,15 @@ class Worker:
|
||||
return completed
|
||||
|
||||
@asyncio.coroutine
|
||||
def prepare(self, rid, pipeline_name, expid):
|
||||
def prepare(self, rid, pipeline_name, expid, priority):
|
||||
self.rid = rid
|
||||
yield from self._create_process()
|
||||
yield from self._worker_action(
|
||||
{"action": "prepare",
|
||||
"rid": rid,
|
||||
"pipeline_name": pipeline_name,
|
||||
"expid": expid},
|
||||
"expid": expid,
|
||||
"priority": priority},
|
||||
self.prepare_timeout)
|
||||
|
||||
@asyncio.coroutine
|
||||
|
@ -79,12 +79,13 @@ class Scheduler:
|
||||
pause = staticmethod(make_parent_action("pause", ""))
|
||||
|
||||
submit = staticmethod(make_parent_action("scheduler_submit",
|
||||
"pipeline_name expid due_date"))
|
||||
"pipeline_name expid priority due_date"))
|
||||
cancel = staticmethod(make_parent_action("scheduler_cancel", "rid"))
|
||||
|
||||
def __init__(self, pipeline_name, expid):
|
||||
def __init__(self, pipeline_name, expid, priority):
|
||||
self.pipeline_name = pipeline_name
|
||||
self.expid = expid
|
||||
self.priority = priority
|
||||
|
||||
|
||||
def get_exp(file, exp):
|
||||
@ -121,9 +122,12 @@ def main():
|
||||
rid = obj["rid"]
|
||||
pipeline_name = obj["pipeline_name"]
|
||||
expid = obj["expid"]
|
||||
priority = obj["priority"]
|
||||
exp = get_exp(expid["file"], expid["experiment"])
|
||||
exp_inst = exp(dbh,
|
||||
scheduler=Scheduler(pipeline_name, expid),
|
||||
scheduler=Scheduler(pipeline_name,
|
||||
expid,
|
||||
priority),
|
||||
**expid["arguments"])
|
||||
rdb.build()
|
||||
put_object({"action": "completed"})
|
||||
|
@ -51,7 +51,7 @@ class FloppingF(Experiment, AutoDB):
|
||||
self.brightness.append(brightness)
|
||||
time.sleep(0.1)
|
||||
self.scheduler.submit(self.scheduler.pipeline_name, self.scheduler.expid,
|
||||
time.time() + 20)
|
||||
self.scheduler.priority, time.time() + 20)
|
||||
|
||||
def analyze(self):
|
||||
popt, pcov = curve_fit(model_numpy,
|
||||
|
Loading…
Reference in New Issue
Block a user