preliminary work for queued experiments
This commit is contained in:
parent
8991e61600
commit
84dd157f08
@ -156,6 +156,8 @@ class DamarisGUI:
|
||||
self.monitor = MonitorWidgets( self.xml_gui )
|
||||
|
||||
self.config = ConfigTab( self.xml_gui )
|
||||
# lock file to prevent other DAMARIS to start immediatly
|
||||
self.lockfile = os.path.expanduser("~/.damaris.lock")
|
||||
|
||||
exp_script = u""
|
||||
if exp_script_filename is not None and exp_script_filename != "":
|
||||
@ -349,7 +351,7 @@ class DamarisGUI:
|
||||
self.sw.enable_editing( )
|
||||
return
|
||||
|
||||
# check whether scripts are syntacticaly valid
|
||||
# check whether scripts are syntactically valid
|
||||
# should be merged with check script function
|
||||
exp_code = None
|
||||
if exp_script != "":
|
||||
@ -408,7 +410,13 @@ class DamarisGUI:
|
||||
# set the text mark for hdf logging
|
||||
if self.log.textbuffer.get_mark( "lastdumped" ) is None:
|
||||
self.log.textbuffer.create_mark( "lastdumped", self.log.textbuffer.get_end_iter( ), left_gravity=True )
|
||||
|
||||
# only observe lock file if you want to start immediatly after start up
|
||||
if self.start_immediatly:
|
||||
while os.path.exists(self.lockfile):
|
||||
time.sleep(0.2)
|
||||
gtk.main_iteration()
|
||||
self.experiment_script_statusbar_label.set_text("Waiting for other experiment to finish ... (Loackfile: %s)" % self.lockfile)
|
||||
print "Lockfile still exists, waiting ... (%s)" % self.lockfile
|
||||
# start experiment
|
||||
try:
|
||||
self.spool_dir = os.path.abspath( actual_config[ "spool_dir" ] )
|
||||
@ -458,6 +466,9 @@ class DamarisGUI:
|
||||
# switch to grapics
|
||||
self.main_notebook.set_current_page( DamarisGUI.Monitor_Display )
|
||||
|
||||
# create lock file
|
||||
print "Creating lockfile %s"%self.lockfile
|
||||
lfile = open(self.lockfile, "w").close()
|
||||
# set running
|
||||
if self.si.exp_handling is not None:
|
||||
self.experiment_script_statusbar_label.set_text( "Experiment Script Running (0)" )
|
||||
@ -604,7 +615,12 @@ class DamarisGUI:
|
||||
|
||||
# keep data to display but throw away everything else
|
||||
self.si = None
|
||||
|
||||
# delete locak file so that other experiment can start
|
||||
if os.path.exists(self.lockfile):
|
||||
try:
|
||||
os.remove(self.lockfile)
|
||||
except:
|
||||
raise IOError("Could not remove lock file: %s"%self.lockfile)
|
||||
return False
|
||||
|
||||
# dump states?
|
||||
@ -3135,7 +3151,7 @@ class ScriptInterface:
|
||||
self.exp_writer = self.res_reader = self.back_driver = None
|
||||
if self.backend_executable is not None and self.backend_executable != "":
|
||||
self.back_driver = BackendDriver.BackendDriver( self.backend_executable, spool_dir, clear_jobs,
|
||||
clear_results )
|
||||
clear_results)
|
||||
if self.exp_script:
|
||||
self.exp_writer = self.back_driver.get_exp_writer( )
|
||||
if self.res_script:
|
||||
|
@ -7,5 +7,5 @@ def test():
|
||||
return e
|
||||
|
||||
def experiment():
|
||||
for i in range(1):
|
||||
yield test()
|
||||
for i in range(1000):
|
||||
yield test()
|
@ -1,4 +1,4 @@
|
||||
def result():
|
||||
for num,ts in enumerate(results):
|
||||
data["ts %i"%num] = ts
|
||||
print ts
|
||||
#print ts
|
Loading…
Reference in New Issue
Block a user