finalized queueing and --clean parameter to recreate the locking

database. Fixes T80 and T88
This commit is contained in:
Markus Rosenstihl 2018-03-23 12:40:05 +01:00
parent 113cc82684
commit a4cf5be73a
2 changed files with 8 additions and 7 deletions

View File

@ -35,12 +35,14 @@ import damaris.gui.DamarisGUI
lockfile = os.path.expanduser('~/.damaris.lockdb') lockfile = os.path.expanduser('~/.damaris.lockdb')
if args.clean: if args.clean:
if os.path.exists(lockfile): if os.path.exists(lockfile):
print "Removing lockfile: %s"%lockfile
os.remove(lockfile) os.remove(lockfile)
else:
print "Lockfile does not exists: %s"%lockfile
lockdb = sqlite3.connect(lockfile) lockdb = sqlite3.connect(lockfile)
c = lockdb.cursor() c = lockdb.cursor()
c.execute("CREATE TABLE IF NOT EXISTS damaris (uuid text, status text)") c.execute("CREATE TABLE IF NOT EXISTS damaris (uuid text, status text)")
print "Make sure experiment table exists"
lockdb.commit() lockdb.commit()
if args.debug: if args.debug:
@ -54,7 +56,6 @@ if args.debug:
matplotlib.rcParams["verbose.level"] = "debug" matplotlib.rcParams["verbose.level"] = "debug"
print args print args
d = damaris.gui.DamarisGUI.DamarisGUI(args.exp_script, args.res_script, start_immediately=args.run) d = damaris.gui.DamarisGUI.DamarisGUI(args.exp_script, args.res_script, start_immediately=args.run)
print "run"
d.run() d.run()
#for exp_script, res_script in args.exp_res_script: #for exp_script, res_script in args.exp_res_script:

View File

@ -211,11 +211,12 @@ class DamarisGUI:
if start_immediately: if start_immediately:
if exp_script and res_script: if exp_script and res_script:
self.start_immediatly = start_immediately self.start_immediately = start_immediately
else: else:
raise ("RuntimeError", "experiment and result scripts not given,\ raise ("RuntimeError", "experiment and result scripts not given,\
aborting immediate start of experiment") aborting immediate start of experiment")
else:
self.start_immediately = False
self.statusbar_init( ) self.statusbar_init( )
self.main_window.maximize() self.main_window.maximize()
@ -271,9 +272,9 @@ class DamarisGUI:
# prolong lifetime of clipboard till the very end (avoid error message) # prolong lifetime of clipboard till the very end (avoid error message)
self.main_clipboard = self.sw.main_clipboard self.main_clipboard = self.sw.main_clipboard
gtk.gdk.threads_enter( ) gtk.gdk.threads_enter( )
if self.start_immediatly:
self.toolbar_run_button.emit("clicked")
if self.start_immediately:
self.toolbar_run_button.emit("clicked")
gtk.main( ) gtk.main( )
gtk.gdk.threads_leave( ) gtk.gdk.threads_leave( )
self.si = None self.si = None
@ -3206,7 +3207,6 @@ class ScriptInterface:
self.data = DataPool( ) self.data = DataPool( )
def runScripts( self ): def runScripts( self ):
try: try:
# get script engines # get script engines
self.exp_handling = self.res_handling = None self.exp_handling = self.res_handling = None