mailr14157 - in /1.3: ./ auto_analyses/ prompt/


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by edward on August 04, 2011 - 20:24:
Author: bugman
Date: Thu Aug  4 20:24:02 2011
New Revision: 14157

URL: http://svn.gna.org/viewcvs/relax?rev=14157&view=rev
Log:
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:
    1.3/auto_analyses/dauvergne_protocol.py
    1.3/auto_analyses/noe.py
    1.3/auto_analyses/relax_fit.py
    1.3/auto_analyses/stereochem_analysis.py
    1.3/prompt/interpreter.py
    1.3/status.py

Modified: 1.3/auto_analyses/dauvergne_protocol.py
URL: 
http://svn.gna.org/viewcvs/relax/1.3/auto_analyses/dauvergne_protocol.py?rev=14157&r1=14156&r2=14157&view=diff
==============================================================================
--- 1.3/auto_analyses/dauvergne_protocol.py (original)
+++ 1.3/auto_analyses/dauvergne_protocol.py Thu Aug  4 20:24:02 2011
@@ -161,7 +161,7 @@
         """
 
         # Execution lock.
-        status.exec_lock.acquire('auto dauvergne protocol')
+        status.exec_lock.acquire('auto dauvergne protocol', 
mode='auto-analysis')
 
         # Store the args.
         self.diff_model = diff_model

Modified: 1.3/auto_analyses/noe.py
URL: 
http://svn.gna.org/viewcvs/relax/1.3/auto_analyses/noe.py?rev=14157&r1=14156&r2=14157&view=diff
==============================================================================
--- 1.3/auto_analyses/noe.py (original)
+++ 1.3/auto_analyses/noe.py Thu Aug  4 20:24:02 2011
@@ -70,7 +70,7 @@
         """
 
         # Execution lock.
-        status.exec_lock.acquire('auto noe')
+        status.exec_lock.acquire('auto noe', mode='auto-analysis')
 
         # Store the args.
         self.pipe_name = pipe_name

Modified: 1.3/auto_analyses/relax_fit.py
URL: 
http://svn.gna.org/viewcvs/relax/1.3/auto_analyses/relax_fit.py?rev=14157&r1=14156&r2=14157&view=diff
==============================================================================
--- 1.3/auto_analyses/relax_fit.py (original)
+++ 1.3/auto_analyses/relax_fit.py Thu Aug  4 20:24:02 2011
@@ -71,7 +71,7 @@
         """
 
         # Execution lock.
-        status.exec_lock.acquire('auto relax fit')
+        status.exec_lock.acquire('auto relax fit', mode='auto-analysis')
 
         # Store the args.
         self.file_root = file_root

Modified: 1.3/auto_analyses/stereochem_analysis.py
URL: 
http://svn.gna.org/viewcvs/relax/1.3/auto_analyses/stereochem_analysis.py?rev=14157&r1=14156&r2=14157&view=diff
==============================================================================
--- 1.3/auto_analyses/stereochem_analysis.py (original)
+++ 1.3/auto_analyses/stereochem_analysis.py Thu Aug  4 20:24:02 2011
@@ -141,7 +141,7 @@
         """
 
         # Execution lock.
-        status.exec_lock.acquire('auto stereochem analysis')
+        status.exec_lock.acquire('auto stereochem analysis', 
mode='auto-analysis')
 
         # Store all the args.
         self.stage = stage

Modified: 1.3/prompt/interpreter.py
URL: 
http://svn.gna.org/viewcvs/relax/1.3/prompt/interpreter.py?rev=14157&r1=14156&r2=14157&view=diff
==============================================================================
--- 1.3/prompt/interpreter.py (original)
+++ 1.3/prompt/interpreter.py Thu Aug  4 20:24:02 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: 1.3/status.py
URL: 
http://svn.gna.org/viewcvs/relax/1.3/status.py?rev=14157&r1=14156&r2=14157&view=diff
==============================================================================
--- 1.3/status.py (original)
+++ 1.3/status.py Thu Aug  4 20:24:02 2011
@@ -95,8 +95,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
@@ -109,15 +110,17 @@
             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
         """
 
         # 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
 
@@ -130,7 +133,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))
@@ -142,8 +145,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:
@@ -198,8 +202,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:




Related Messages


Powered by MHonArc, Updated Thu Aug 04 20:40:02 2011