Skip to content
Permalink
Browse files

dashboard: add support for experiment pipeline/priority/flush defaults

  • Loading branch information...
cjbe authored and jordens committed Feb 2, 2019
1 parent 8659c76 commit c56c3e5588791b6eff46906600b93fd4330f8711
Showing with 38 additions and 10 deletions.
  1. +38 −10 artiq/dashboard/experiments.py
@@ -162,14 +162,14 @@ def _recompute_argument_clicked(self, name):

async def _recompute_argument(self, name):
try:
arginfo = await self.manager.compute_arginfo(self.expurl)
expdesc = await self.manager.compute_expdesc(self.expurl)
except:
logger.error("Could not recompute argument '%s' of '%s'",
name, self.expurl, exc_info=True)
return
argument = self.manager.get_submission_arguments(self.expurl)[name]

procdesc = arginfo[name][0]
procdesc = expdesc["arginfo"][name][0]
state = procdesc_to_entry(procdesc).default_state(procdesc)
argument["desc"] = procdesc
argument["state"] = state
@@ -272,17 +272,19 @@ def update_datetime_en(checked):
scheduling["due_date"] = due_date
datetime_en.stateChanged.connect(update_datetime_en)

pipeline_name = QtWidgets.QLineEdit()
self.pipeline_name = QtWidgets.QLineEdit()
pipeline_name = self.pipeline_name
self.layout.addWidget(QtWidgets.QLabel("Pipeline:"), 1, 2)
self.layout.addWidget(pipeline_name, 1, 3)

pipeline_name.setText(scheduling["pipeline_name"])

def update_pipeline_name(text):
scheduling["pipeline_name"] = text
pipeline_name.textEdited.connect(update_pipeline_name)
pipeline_name.textChanged.connect(update_pipeline_name)

priority = QtWidgets.QSpinBox()
self.priority = QtWidgets.QSpinBox()
priority = self.priority
priority.setRange(-99, 99)
self.layout.addWidget(QtWidgets.QLabel("Priority:"), 2, 0)
self.layout.addWidget(priority, 2, 1)
@@ -293,7 +295,8 @@ def update_priority(value):
scheduling["priority"] = value
priority.valueChanged.connect(update_priority)

flush = QtWidgets.QCheckBox("Flush")
self.flush = QtWidgets.QCheckBox("Flush")
flush = self.flush
flush.setToolTip("Flush the pipeline (of current- and higher-priority "
"experiments) before starting the experiment")
self.layout.addWidget(flush, 2, 2, 1, 2)
@@ -386,11 +389,12 @@ def _recompute_arguments_clicked(self):

async def _recompute_arguments_task(self, overrides=dict()):
try:
arginfo = await self.manager.compute_arginfo(self.expurl)
expdesc = await self.manager.compute_expdesc(self.expurl)
except:
logger.error("Could not recompute arguments of '%s'",
logger.error("Could not recompute experiment description of '%s'",
self.expurl, exc_info=True)
return
arginfo = expdesc["arginfo"]
for k, v in overrides.items():
# Some values (e.g. scans) may have multiple defaults in a list
if ("default" in arginfo[k][0]
@@ -407,6 +411,28 @@ def _recompute_arguments_clicked(self):
self.argeditor.restore_state(argeditor_state)
self.layout.addWidget(self.argeditor, 0, 0, 1, 5)

def contextMenuEvent(self, event):
menu = QtWidgets.QMenu(self)
reset_sched = menu.addAction("Reset scheduler settings")
action = menu.exec_(self.mapToGlobal(event.pos()))
if action == reset_sched:
asyncio.ensure_future(self._recompute_sched_options_task())

async def _recompute_sched_options_task(self):
try:
expdesc = await self.manager.compute_expdesc(self.expurl)
except:
logger.error("Could not recompute experiment description of '%s'",
self.expurl, exc_info=True)
return
sched_defaults = expdesc["scheduler_defaults"]

scheduling = self.manager.get_submission_scheduling(self.expurl)
scheduling.update(sched_defaults)
self.priority.setValue(scheduling["priority"])
self.pipeline_name.setText(scheduling["pipeline_name"])
self.flush.setChecked(scheduling["flush"])

def _load_hdf5_clicked(self):
asyncio.ensure_future(self._load_hdf5_task())

@@ -508,6 +534,8 @@ def get_submission_scheduling(self, expurl):
"due_date": None,
"flush": False
}
if expurl[:5] == "repo:":
scheduling.update(self.explist[expurl[5:]]["scheduler_defaults"])
self.submission_scheduling[expurl] = scheduling
return scheduling

@@ -640,15 +668,15 @@ def request_inst_term(self, expurl):
rids.append(rid)
asyncio.ensure_future(self._request_term_multiple(rids))

async def compute_arginfo(self, expurl):
async def compute_expdesc(self, expurl):
file, class_name, use_repository = self.resolve_expurl(expurl)
if use_repository:
revision = self.get_submission_options(expurl)["repo_rev"]
else:
revision = None
description = await self.experiment_db_ctl.examine(
file, use_repository, revision)
return description[class_name]["arginfo"]
return description[class_name]

async def open_file(self, file):
description = await self.experiment_db_ctl.examine(file, False)

0 comments on commit c56c3e5

Please sign in to comment.
You can’t perform that action at this time.