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
|
@asyncio.coroutine
|
||||||
def prepare(self):
|
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")
|
run = _mk_worker_method("run")
|
||||||
resume = _mk_worker_method("resume")
|
resume = _mk_worker_method("resume")
|
||||||
|
|
|
@ -202,14 +202,15 @@ class Worker:
|
||||||
return completed
|
return completed
|
||||||
|
|
||||||
@asyncio.coroutine
|
@asyncio.coroutine
|
||||||
def prepare(self, rid, pipeline_name, expid):
|
def prepare(self, rid, pipeline_name, expid, priority):
|
||||||
self.rid = rid
|
self.rid = rid
|
||||||
yield from self._create_process()
|
yield from self._create_process()
|
||||||
yield from self._worker_action(
|
yield from self._worker_action(
|
||||||
{"action": "prepare",
|
{"action": "prepare",
|
||||||
"rid": rid,
|
"rid": rid,
|
||||||
"pipeline_name": pipeline_name,
|
"pipeline_name": pipeline_name,
|
||||||
"expid": expid},
|
"expid": expid,
|
||||||
|
"priority": priority},
|
||||||
self.prepare_timeout)
|
self.prepare_timeout)
|
||||||
|
|
||||||
@asyncio.coroutine
|
@asyncio.coroutine
|
||||||
|
|
|
@ -79,12 +79,13 @@ class Scheduler:
|
||||||
pause = staticmethod(make_parent_action("pause", ""))
|
pause = staticmethod(make_parent_action("pause", ""))
|
||||||
|
|
||||||
submit = staticmethod(make_parent_action("scheduler_submit",
|
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"))
|
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.pipeline_name = pipeline_name
|
||||||
self.expid = expid
|
self.expid = expid
|
||||||
|
self.priority = priority
|
||||||
|
|
||||||
|
|
||||||
def get_exp(file, exp):
|
def get_exp(file, exp):
|
||||||
|
@ -121,9 +122,12 @@ def main():
|
||||||
rid = obj["rid"]
|
rid = obj["rid"]
|
||||||
pipeline_name = obj["pipeline_name"]
|
pipeline_name = obj["pipeline_name"]
|
||||||
expid = obj["expid"]
|
expid = obj["expid"]
|
||||||
|
priority = obj["priority"]
|
||||||
exp = get_exp(expid["file"], expid["experiment"])
|
exp = get_exp(expid["file"], expid["experiment"])
|
||||||
exp_inst = exp(dbh,
|
exp_inst = exp(dbh,
|
||||||
scheduler=Scheduler(pipeline_name, expid),
|
scheduler=Scheduler(pipeline_name,
|
||||||
|
expid,
|
||||||
|
priority),
|
||||||
**expid["arguments"])
|
**expid["arguments"])
|
||||||
rdb.build()
|
rdb.build()
|
||||||
put_object({"action": "completed"})
|
put_object({"action": "completed"})
|
||||||
|
|
|
@ -51,7 +51,7 @@ class FloppingF(Experiment, AutoDB):
|
||||||
self.brightness.append(brightness)
|
self.brightness.append(brightness)
|
||||||
time.sleep(0.1)
|
time.sleep(0.1)
|
||||||
self.scheduler.submit(self.scheduler.pipeline_name, self.scheduler.expid,
|
self.scheduler.submit(self.scheduler.pipeline_name, self.scheduler.expid,
|
||||||
time.time() + 20)
|
self.scheduler.priority, time.time() + 20)
|
||||||
|
|
||||||
def analyze(self):
|
def analyze(self):
|
||||||
popt, pcov = curve_fit(model_numpy,
|
popt, pcov = curve_fit(model_numpy,
|
||||||
|
|
Loading…
Reference in New Issue