mailr14180 - in /branches/gui_testing: ./ auto_analyses/dauvergne_protocol.py


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

Header


Content

Posted by edward on August 05, 2011 - 15:03:
Author: bugman
Date: Fri Aug  5 15:03:55 2011
New Revision: 14180

URL: http://svn.gna.org/viewcvs/relax?rev=14180&view=rev
Log:
Merged revisions 14179 via svnmerge from 
svn+ssh://bugman@xxxxxxxxxxx/svn/relax/1.3

........
  r14179 | bugman | 2011-08-05 15:01:19 +0200 (Fri, 05 Aug 2011) | 5 lines
  
  The dauvergne_protocol is now more robust if the program is interrupted and 
restarted later.
  
  The opt/results.bz2 file is now searched for, and if not the round is 
assumed incomplete.
........

Modified:
    branches/gui_testing/   (props changed)
    branches/gui_testing/auto_analyses/dauvergne_protocol.py

Propchange: branches/gui_testing/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Fri Aug  5 15:03:55 2011
@@ -1,1 +1,1 @@
-/1.3:1-14157
+/1.3:1-14179

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=14180&r1=14179&r2=14180&view=diff
==============================================================================
--- branches/gui_testing/auto_analyses/dauvergne_protocol.py (original)
+++ branches/gui_testing/auto_analyses/dauvergne_protocol.py Fri Aug  5 
15:03:55 2011
@@ -21,7 +21,7 @@
 
###############################################################################
 
 # Python module imports.
-from os import getcwd, listdir, sep
+from os import F_OK, access, getcwd, listdir, sep
 from re import search
 from string import lower
 
@@ -450,13 +450,7 @@
 
         # Get a list of all files in the directory model.  If no directory 
exists, set the round to 'init' or 0.
         try:
-            # Files are in same directory / no directory specified
-            if self.results_dir =='':
-                dir_list = listdir(self.results_dir+sep+model)
-
-            # Directory is specified
-            else:
-                dir_list = listdir(self.results_dir+model)
+            dir_list = listdir(self.results_dir+sep+model)
         except:
             return 0
 
@@ -479,12 +473,35 @@
                 pass
         numbers.sort()
 
-        # No directories begining with 'round_' exist, set the round to 1.
+        # No directories beginning with 'round_' exist, set the round to 1.
         if not len(numbers):
             return 1
 
-        # Determine the number for the next round (add 1 to the highest 
number).
-        return numbers[-1] + 1
+        # The highest number.
+        max_round = numbers[-1]
+
+        # Check that the opt/results file exists for the round (working 
backwards).
+        for i in range(max_round, -1, -1):
+            # Assume the round is complete.
+            complete_round = i
+
+            # The file root.
+            file_root = self.results_dir + sep + model + sep + "round_%i" %i 
+ sep + 'results'
+
+            # Stop looping when the opt/results file is found.
+            if access(file_root + '.bz2', F_OK):
+                break
+            if access(file_root + '.gz', F_OK):
+                break
+            if access(file_root, F_OK):
+                break
+
+        # No round, so assume the initial state.
+        if complete_round == 0:
+            return 0
+
+        # Determine the number for the next round (add 1 to the highest 
completed round).
+        return complete_round + 1
 
 
     def execute(self):




Related Messages


Powered by MHonArc, Updated Fri Aug 05 16:00:02 2011