2
0
mirror of https://github.com/m-labs/artiq.git synced 2024-12-27 20:28:25 +08:00

scheduler: pass priority to experiments

This commit is contained in:
Sebastien Bourdeauducq 2015-05-24 20:37:47 +08:00
parent e611e17eeb
commit fc449509b8
4 changed files with 13 additions and 7 deletions

View File

@ -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")

View File

@ -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

View File

@ -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"})

View File

@ -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,