Mercurial > pylearn
changeset 631:e52a5c3aaca5
added priority keyword arg to sql.insert_job and insert_dict
author | James Bergstra <bergstrj@iro.umontreal.ca> |
---|---|
date | Tue, 20 Jan 2009 23:32:24 -0500 |
parents | 24237be52cfd |
children | 9b24b4345f52 9fb784c1f23d |
files | pylearn/dbdict/sql.py |
diffstat | 1 files changed, 4 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/pylearn/dbdict/sql.py Tue Jan 20 23:30:17 2009 -0500 +++ b/pylearn/dbdict/sql.py Tue Jan 20 23:32:24 2009 -0500 @@ -212,7 +212,7 @@ # Queue ########### -def insert_dict(jobdict, db, force_dup=False, session=None): +def insert_dict(jobdict, db, force_dup=False, session=None, priority=1.0): """Insert a new `job` dictionary into database `db`. :param force_dup: forces insertion even if an identical dictionary is already in the db @@ -233,7 +233,7 @@ if do_insert: job[STATUS] = START job[HASH] = jobhash - job[PRIORITY] = 1.0 + job[PRIORITY] = priority rval = db.insert(job, session=s) s.commit() @@ -242,10 +242,10 @@ return rval -def insert_job(experiment_fn, state, db, force_dup=False, session=None): +def insert_job(experiment_fn, state, db, force_dup=False, session=None, priority=1.0): state = copy.copy(state) state[EXPERIMENT] = experiment_fn.__module__ + '.' + experiment_fn.__name__ - return insert_dict(state, db, force_dup=force_dup, session=session) + return insert_dict(state, db, force_dup=force_dup, session=session, priority=priority) # TODO: FIXME: WARNING