mailr26298 - in /branches/frame_order_cleanup: ./ 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 October 16, 2014 - 18:18:
Author: bugman
Date: Thu Oct 16 18:18:54 2014
New Revision: 26298

URL: http://svn.gna.org/viewcvs/relax?rev=26298&view=rev
Log:
Merged revisions 26283-26285 via svnmerge from 
svn+ssh://bugman@xxxxxxxxxxx/svn/relax/trunk

........
  r26283 | bugman | 2014-10-15 11:38:09 +0200 (Wed, 15 Oct 2014) | 13 lines
  
  Added more checks to the determine_rnd() of the dauvergne_protocol 
model-free auto-analysis.
  
  This is to try to catch bizarre situations such as bug #22730 
(https://gna.org/bugs/?22730),
  model-free auto-analysis - relax stops and quits at the polate step.
  
  The following additional fatal conditions are now checked for:  A file with 
the same name as the
  base model directory already exists;  The base model directory is not 
readable;  The base model
  directory is not writable.  The last two could be caused by file system 
corruptions.  In addition,
  the presence of the base model directory is checked for using 
os.path.isdir() rather than catching
  errors coming out of the os.listdir() function.  These changes should make 
the analysis more robust
  in the presence of 'strangeness'.
........
  r26284 | bugman | 2014-10-15 11:42:25 +0200 (Wed, 15 Oct 2014) | 8 lines
  
  Added an additional check to determine_rnd() of the dauvergne_protocol 
model-free auto-analysis.
  
  This is to try to catch bizarre situations such as bug #22730 
(https://gna.org/bugs/?22730),
  model-free auto-analysis - relax stops and quits at the polate step.
  
  The additional check is that if the base model directory is not executable, 
a RelaxError is raised.
........
  r26285 | bugman | 2014-10-15 13:02:27 +0200 (Wed, 15 Oct 2014) | 7 lines
  
  Added printouts to the determine_rnd() function of the dauvergne_protocol 
model-free auto-analysis.
  
  This is for better user feedback in the log files as to what is happening.  
It may help in debugging
  bug #22730 (https://gna.org/bugs/?22730): Model-free auto-analysis - relax 
stops and quits at the
  polate step.
........

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

Propchange: branches/frame_order_cleanup/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Thu Oct 16 18:18:54 2014
@@ -1 +1 @@
-/trunk:1-26278
+/trunk:1-26278,26283-26285

Modified: branches/frame_order_cleanup/auto_analyses/dauvergne_protocol.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/frame_order_cleanup/auto_analyses/dauvergne_protocol.py?rev=26298&r1=26297&r2=26298&view=diff
==============================================================================
--- branches/frame_order_cleanup/auto_analyses/dauvergne_protocol.py    
(original)
+++ branches/frame_order_cleanup/auto_analyses/dauvergne_protocol.py    Thu 
Oct 16 18:18:54 2014
@@ -21,9 +21,11 @@
 
 # Python module imports.
 from math import pi
-from os import F_OK, access, getcwd, listdir, sep
+from os import F_OK, R_OK, W_OK, X_OK, access, getcwd, listdir, sep
+from os.path import isdir
 from re import search
 from time import sleep
+import sys
 
 # relax module imports.
 from lib.float import floatAsByteArray
@@ -494,14 +496,35 @@
     def determine_rnd(self, model=None):
         """Function for returning the name of next round of optimisation."""
 
-        # Get a list of all files in the directory model.  If no directory 
exists, set the round to 'init' or 0.
-        try:
-            dir_list = listdir(self.results_dir+sep+model)
-        except:
+        # The base model directory.
+        base_dir = self.results_dir+sep+model
+
+        # Printout.
+        sys.stdout.write("\n\nDetermining the next round of optimisation for 
'%s':  " % base_dir)
+
+        # Catch if a file exists with the name of the directory.
+        if not isdir(base_dir) and access(base_dir, F_OK):
+            raise RelaxError("The base model directory '%s' is not usable as 
a file with the same name already exists." % base_dir)
+
+        # If no directory exists, set the round to 'init' or 0.
+        if not isdir(base_dir):
+            sys.stdout.write(" 0.\n\n")
             return 0
+
+        # Is the directory readable, writable, and executable.
+        if not access(base_dir, R_OK):
+            raise RelaxError("The base model directory '%s' is not 
readable." % base_dir)
+        if not access(base_dir, W_OK):
+            raise RelaxError("The base model directory '%s' is not 
writable." % base_dir)
+        if not access(base_dir, X_OK):
+            raise RelaxError("The base model directory '%s' is not 
executable." % base_dir)
+
+        # Get a list of all files in the directory model.
+        dir_list = listdir(base_dir)
 
         # Set the round to 'init' or 0 if there is no directory called 
'init'.
         if 'init' not in dir_list:
+            sys.stdout.write(" 0.\n\n")
             return 0
 
         # Create a list of all files which begin with 'round_'.
@@ -521,6 +544,7 @@
 
         # No directories beginning with 'round_' exist, set the round to 1.
         if not len(numbers):
+            sys.stdout.write(" 1.\n\n")
             return 1
 
         # The highest number.
@@ -532,7 +556,7 @@
             complete_round = i
 
             # The file root.
-            file_root = self.results_dir + sep + model + sep + "round_%i" % 
i + sep + 'opt' + sep + 'results'
+            file_root = base_dir + sep + "round_%i" % i + sep + 'opt' + sep 
+ 'results'
 
             # Stop looping when the opt/results file is found.
             if access(file_root + '.bz2', F_OK):
@@ -544,9 +568,11 @@
 
         # No round, so assume the initial state.
         if complete_round == 0:
+            sys.stdout.write(" 0.\n\n")
             return 0
 
         # Determine the number for the next round (add 1 to the highest 
completed round).
+        sys.stdout.write(" %i.\n\n" % complete_round + 1)
         return complete_round + 1
 
 




Related Messages


Powered by MHonArc, Updated Thu Oct 16 18:20:03 2014