Author: bugman Date: Thu Aug 4 20:32:43 2011 New Revision: 14158 URL: http://svn.gna.org/viewcvs/relax?rev=14158&view=rev Log: Merged revisions 14157 via svnmerge from svn+ssh://bugman@xxxxxxxxxxx/svn/relax/1.3 ........ r14157 | bugman | 2011-08-04 20:24:02 +0200 (Thu, 04 Aug 2011) | 6 lines Modified the execution lock to have a mode. This allows for greater control and avoid string comparison of names to determine if a script or auto-analysis acquired the lock. ........ Modified: branches/gui_testing/ (props changed) branches/gui_testing/auto_analyses/dauvergne_protocol.py branches/gui_testing/auto_analyses/noe.py branches/gui_testing/auto_analyses/relax_fit.py branches/gui_testing/auto_analyses/stereochem_analysis.py branches/gui_testing/prompt/interpreter.py branches/gui_testing/status.py Propchange: branches/gui_testing/ ------------------------------------------------------------------------------ --- svnmerge-integrated (original) +++ svnmerge-integrated Thu Aug 4 20:32:43 2011 @@ -1,1 +1,1 @@ -/1.3:1-14146 +/1.3:1-14157 Modified: branches/gui_testing/auto_analyses/dauvergne_protocol.py URL: http://svn.gna.org/viewcvs/relax/branches/gui_testing/auto_analyses/dauvergne_protocol.py?rev=14158&r1=14157&r2=14158&view=diff ============================================================================== --- branches/gui_testing/auto_analyses/dauvergne_protocol.py (original) +++ branches/gui_testing/auto_analyses/dauvergne_protocol.py Thu Aug 4 20:32:43 2011 @@ -140,7 +140,7 @@ """ # Execution lock. - status.exec_lock.acquire(pipe_name) + status.exec_lock.acquire(pipe_name, mode='auto-analysis') # Store the args. self.pipe_name = pipe_name Modified: branches/gui_testing/auto_analyses/noe.py URL: http://svn.gna.org/viewcvs/relax/branches/gui_testing/auto_analyses/noe.py?rev=14158&r1=14157&r2=14158&view=diff ============================================================================== --- branches/gui_testing/auto_analyses/noe.py (original) +++ branches/gui_testing/auto_analyses/noe.py Thu Aug 4 20:32:43 2011 @@ -57,7 +57,7 @@ """ # Execution lock. - status.exec_lock.acquire(pipe_name) + status.exec_lock.acquire(pipe_name, mode='auto-analysis') # Set up the analysis status object. status.init_auto_analysis(pipe_name, type='noe') Modified: branches/gui_testing/auto_analyses/relax_fit.py URL: http://svn.gna.org/viewcvs/relax/branches/gui_testing/auto_analyses/relax_fit.py?rev=14158&r1=14157&r2=14158&view=diff ============================================================================== --- branches/gui_testing/auto_analyses/relax_fit.py (original) +++ branches/gui_testing/auto_analyses/relax_fit.py Thu Aug 4 20:32:43 2011 @@ -60,7 +60,7 @@ """ # Execution lock. - status.exec_lock.acquire(pipe_name) + status.exec_lock.acquire(pipe_name, mode='auto-analysis') # Set up the analysis status object. status.init_auto_analysis(pipe_name, type='relax_fit') Modified: branches/gui_testing/auto_analyses/stereochem_analysis.py URL: http://svn.gna.org/viewcvs/relax/branches/gui_testing/auto_analyses/stereochem_analysis.py?rev=14158&r1=14157&r2=14158&view=diff ============================================================================== --- branches/gui_testing/auto_analyses/stereochem_analysis.py (original) +++ branches/gui_testing/auto_analyses/stereochem_analysis.py Thu Aug 4 20:32:43 2011 @@ -141,7 +141,7 @@ """ # Execution lock. - status.exec_lock.acquire('auto stereochem analysis') + status.exec_lock.acquire('auto stereochem analysis', mode='auto-analysis') # Set up the analysis status object. status.init_auto_analysis('stereochem', type='stereochem') Modified: branches/gui_testing/prompt/interpreter.py URL: http://svn.gna.org/viewcvs/relax/branches/gui_testing/prompt/interpreter.py?rev=14158&r1=14157&r2=14158&view=diff ============================================================================== --- branches/gui_testing/prompt/interpreter.py (original) +++ branches/gui_testing/prompt/interpreter.py Thu Aug 4 20:32:43 2011 @@ -349,7 +349,7 @@ """Execute the script.""" # Execution lock. - status.exec_lock.acquire('script UI') + status.exec_lock.acquire('script UI', mode='script') # The module path. head, tail = path.split(name) Modified: branches/gui_testing/status.py URL: http://svn.gna.org/viewcvs/relax/branches/gui_testing/status.py?rev=14158&r1=14157&r2=14158&view=diff ============================================================================== --- branches/gui_testing/status.py (original) +++ branches/gui_testing/status.py Thu Aug 4 20:32:43 2011 @@ -189,8 +189,9 @@ # Init a threading.Lock object. self._lock = Lock() - # The name of the locker. + # The name and mode of the locker. self._name = None + self._mode = None # Script nesting level. self._script_nest = 0 @@ -203,11 +204,13 @@ self.log = open('lock.log', 'w') - def acquire(self, name): + def acquire(self, name, mode='script'): """Simulate the Lock.acquire() mechanism. @param name: The name of the locking code. @type name: str + @keyword mode: The mode of the code trying to obtain the lock. This can be one of 'script' for the scripting interface or 'auto-analysis' for the auto-analyses. + @type mode: str """ # Notify observers. @@ -215,7 +218,7 @@ status.observers.exec_lock.notify() # Do not acquire if lunching a script from a script. - if name == 'script UI' and self._name == 'script UI' and self.locked(): + if mode == 'script' and self._mode == 'script' and self.locked(): # Increment the nesting counter. self._script_nest += 1 @@ -228,7 +231,7 @@ return # Skip locking if an auto-analysis is called from a script. - if self.locked() and self._name == 'script UI' and search('^auto', name): + if self.locked() and self._mode == 'script' and mode == 'auto-analysis': # Debugging. if self.debug: self.log.write("Skipped unlocking of '%s' lock by '%s'\n" % (self._name, name)) @@ -240,8 +243,9 @@ # Return without doing anything. return - # Store the new name. + # Store the new name and mode. self._name = name + self._mode = mode # Debugging. if self.debug: @@ -300,8 +304,9 @@ # Return without releasing the lock. return - # Reset the name. + # Reset the name and mode. self._name = None + self._mode = None # Debugging. if self.debug: