changeset 609:7cee8c7f0449

added -f flag to sqlschedule and sqlschedule_filemerge
author Olivier Breuleux <breuleuo@iro.umontreal.ca>
date Fri, 16 Jan 2009 15:53:22 -0500
parents 52a99d83f06d
children e8cb4bde30a7
files pylearn/dbdict/newstuff.py
diffstat 1 files changed, 6 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/pylearn/dbdict/newstuff.py	Thu Jan 15 17:12:36 2009 -0500
+++ b/pylearn/dbdict/newstuff.py	Fri Jan 16 15:53:22 2009 -0500
@@ -635,6 +635,8 @@
 
 
 parser_sqlschedule = OptionParser(usage = '%prog sqlschedule [options] <tablepath> <experiment> <parameters>')
+parser_sqlschedule.add_option('-f', '--force', action = 'store_true', dest = 'force', default = False,
+                              help = 'force adding the experiment to the database even if it is already there')
 
 def runner_sqlschedule(options, dbdescr, experiment, *strings):
     """
@@ -686,13 +688,15 @@
     except:
         raise UsageError('The first parameter to sqlschedule must be a valid, importable symbol.')
     state['dbdict.experiment'] = experiment
-    sql.add_experiments_to_db([state], db, verbose = 1)
+    sql.add_experiments_to_db([state], db, verbose = 1, add_dups = options.force)
 
 runner_registry['sqlschedule'] = (parser_sqlschedule, runner_sqlschedule)
 
 
 
 parser_sqlschedule_filemerge = OptionParser(usage = '%prog sqlschedule_filemerge [options] <tablepath> <experiment> <parameters|files>')
+parser_sqlschedule_filemerge.add_option('-f', '--force', action = 'store_true', dest = 'force', default = False,
+                                        help = 'force adding the experiment to the database even if it is already there')
 
 def runner_sqlschedule_filemerge(options, dbdescr, experiment, mainfile, *other_files):
     """
@@ -730,7 +734,7 @@
     except:
         raise UsageError('The first parameter to sqlschedule_filemerge must be a valid, importable symbol.')
     state['dbdict.experiment'] = experiment
-    sql.add_experiments_to_db([state], db, verbose = 1)
+    sql.add_experiments_to_db([state], db, verbose = 1, add_dups = options.force)
 
 runner_registry['sqlschedule_filemerge'] = (parser_sqlschedule_filemerge, runner_sqlschedule_filemerge)