Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: m-labs/artiq
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 4da377eef09b
Choose a base ref
...
head repository: m-labs/artiq
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: aa242f7c66cc
Choose a head ref
  • 5 commits
  • 9 files changed
  • 1 contributor

Commits on May 28, 2015

  1. Copy the full SHA
    737f6d4 View commit details
  2. Copy the full SHA
    4a7c695 View commit details
  3. Copy the full SHA
    e752e57 View commit details
  4. Copy the full SHA
    b0f8141 View commit details
  5. scheduler: simplify priority policy

    Remove overdueness. User must submit calibration experiments with higher priority values for them to take precedence.
    sbourdeauducq committed May 28, 2015
    Copy the full SHA
    aa242f7 View commit details
14 changes: 9 additions & 5 deletions artiq/frontend/artiq_client.py
Original file line number Diff line number Diff line change
@@ -32,14 +32,17 @@ def get_argparser():
subparsers.required = True

parser_add = subparsers.add_parser("submit", help="submit an experiment")
parser_add.add_argument("-t", "--timed", default=None, type=str,
help="set a due date for the experiment")
parser_add.add_argument("-p", "--pipeline", default="main", type=str,
help="pipeline to run the experiment in "
"(default: %(default)s)")
parser_add.add_argument("-P", "--priority", default=0, type=int,
help="priority (higher value means sooner "
"scheduling, default: %(default)s)")
parser_add.add_argument("-t", "--timed", default=None, type=str,
help="set a due date for the experiment")
parser_add.add_argument("-f", "--flush", default=False, action="store_true",
help="flush the pipeline before preparing "
"the experiment")
parser_add.add_argument("-e", "--experiment", default=None,
help="experiment to run")
parser_add.add_argument("file",
@@ -106,7 +109,8 @@ def _action_submit(remote, args):
due_date = None
else:
due_date = time.mktime(parse_date(args.timed).timetuple())
rid = remote.submit(args.pipeline, expid, args.priority, due_date)
rid = remote.submit(args.pipeline, expid,
args.priority, due_date, args.flush)
print("RID: {}".format(rid))


@@ -134,8 +138,8 @@ def _show_schedule(schedule):
clear_screen()
if schedule:
l = sorted(schedule.items(),
key=lambda x: (x[1]["due_date"] or 0,
-x[1]["priority"],
key=lambda x: (-x[1]["priority"],
x[1]["due_date"] or 0,
x[0]))
table = PrettyTable(["RID", "Pipeline", " Status ", "Prio",
"Due date", "File", "Experiment", "Arguments"])
33 changes: 14 additions & 19 deletions artiq/frontend/artiq_run.py
Original file line number Diff line number Diff line change
@@ -48,28 +48,21 @@ def __exit__(self, type, value, traceback):


class DummyScheduler:
def __init__(self):
def __init__(self, expid):
self.next_rid = 0
self.next_trid = 0
self.pipeline_name = "main"
self.priority = 0
self.expid = expid

def run_queued(self, run_params):
def submit(self, pipeline_name, expid, priority, due_date, flush):
rid = self.next_rid
self.next_rid += 1
logger.info("Queuing: %s, RID=%s", run_params, rid)
logger.info("Submitting: %s, RID=%s", expid, rid)
return rid

def cancel_queued(self, rid):
logger.info("Cancelling RID %s", rid)

def run_timed(self, run_params, next_run):
trid = self.next_trid
self.next_trid += 1
next_run_s = time.strftime("%m/%d %H:%M:%S", time.localtime(next_run))
logger.info("Timing: %s at %s, TRID=%s", run_params, next_run_s, trid)
return trid

def cancel_timed(self, trid):
logger.info("Cancelling TRID %s", trid)
def delete(self, rid):
logger.info("Deleting RID %s", rid)

watchdog = DummyWatchdog

@@ -115,11 +108,13 @@ def _build_experiment(dbh, args):
file = getattr(module, "__file__")
exp = get_experiment(module, args.experiment)
arguments = parse_arguments(args.arguments)
expid = {
"file": file,
"experiment": args.experiment,
"arguments": arguments
}
return exp(dbh,
scheduler=DummyScheduler(),
run_params=dict(file=file,
experiment=args.experiment,
arguments=arguments),
scheduler=DummyScheduler(expid),
**arguments)


22 changes: 13 additions & 9 deletions artiq/gui/explorer.py
Original file line number Diff line number Diff line change
@@ -41,19 +41,22 @@ def __init__(self, status_bar, schedule_ctl):
self.datetime.setDisplayFormat("MMM d yyyy hh:mm:ss")
self.datetime.setCalendarPopup(True)
self.datetime.setDate(QtCore.QDate.currentDate())
self.datetime_en = QtGui.QCheckBox("Set due date:")
self.datetime_en = QtGui.QCheckBox("Due date:")
grid.addWidget(self.datetime_en, 1, 0)
grid.addWidget(self.datetime, 1, 1, colspan=3)
grid.addWidget(self.datetime, 1, 1)

self.priority = QtGui.QSpinBox()
self.priority.setRange(-99, 99)
grid.addLabel("Priority:", 1, 2)
grid.addWidget(self.priority, 1, 3)

self.pipeline = QtGui.QLineEdit()
self.pipeline.insert("main")
grid.addLabel("Pipeline:", 2, 0)
grid.addWidget(self.pipeline, 2, 1)

self.priority = QtGui.QSpinBox()
self.priority.setRange(-99, 99)
grid.addLabel("Priority:", 2, 2)
grid.addWidget(self.priority, 2, 3)
self.flush = QtGui.QCheckBox("Flush")
grid.addWidget(self.flush, 2, 2, colspan=2)

submit = QtGui.QPushButton("Submit")
grid.addWidget(submit, 3, 0, colspan=4)
@@ -79,14 +82,14 @@ def init_explist_model(self, init):

@asyncio.coroutine
def submit(self, pipeline_name, file, experiment, arguments,
priority, due_date):
priority, due_date, flush):
expid = {
"file": file,
"experiment": experiment,
"arguments": arguments,
}
rid = yield from self.schedule_ctl.submit(pipeline_name, expid,
priority, due_date)
priority, due_date, flush)
self.status_bar.showMessage("Submitted RID {}".format(rid))

def submit_clicked(self):
@@ -101,4 +104,5 @@ def submit_clicked(self):
due_date = None
asyncio.async(self.submit(self.pipeline.text(),
expinfo["file"], expinfo["experiment"],
dict(), self.priority.value(), due_date))
dict(), self.priority.value(), due_date,
self.flush.isChecked()))
4 changes: 2 additions & 2 deletions artiq/gui/schedule.py
Original file line number Diff line number Diff line change
@@ -17,8 +17,8 @@ def __init__(self, parent, init):
parent, init)

def sort_key(self, k, v):
# order by due date, and then by priority and RID
return (v["due_date"] or 0, -v["priority"], k)
# order by priority, and then by due date and RID
return (-v["priority"], v["due_date"] or 0, k)

def convert(self, k, v, column):
if column == 0:
Loading