Author: semor Date: Thu Aug 25 14:43:50 2011 New Revision: 14450 URL: http://svn.gna.org/viewcvs/relax?rev=14450&view=rev Log: Merged revisions 14428-14429,14431,14433,14436-14442,14446-14447 via svnmerge from svn+ssh://semor@xxxxxxxxxxx/svn/relax/1.3 ........ r14428 | bugman | 2011-08-25 11:41:18 +0200 (Thu, 25 Aug 2011) | 5 lines Deleted the STDOUT and STDERR capture mess in MF_minimise_command! This was a horrible design breaking both the GUI and the test suite!!! ........ r14429 | bugman | 2011-08-25 11:42:03 +0200 (Thu, 25 Aug 2011) | 5 lines The uni-processor call to capture_stdio() has been removed. No IO redirection will be performed in uni-processor mode. ........ r14431 | bugman | 2011-08-25 11:49:34 +0200 (Thu, 25 Aug 2011) | 6 lines Removed the IO redirection from the uni-processor return_object() method. IO redirection in the 'multi' package is a bad, bad idea and destroys all IO redirection any Python program is attempting to do. ........ r14433 | bugman | 2011-08-25 11:55:56 +0200 (Thu, 25 Aug 2011) | 6 lines Eliminated the restore_stdio() method from the multi package. The redirection of IO streams is totally incompatible with an IO redirection performed by the underlying Python program. ........ r14436 | bugman | 2011-08-25 12:12:25 +0200 (Thu, 25 Aug 2011) | 5 lines Fix for the RelaxError system - the status singleton was not being imported. This was a result of a faulty merger of the gui_testing branch. ........ r14437 | bugman | 2011-08-25 12:13:07 +0200 (Thu, 25 Aug 2011) | 5 lines Removed the _sys_exit module variable from the mpi4py processor. This is unnecessary. ........ r14438 | bugman | 2011-08-25 12:18:40 +0200 (Thu, 25 Aug 2011) | 3 lines Removed a pile of unused code from the mpi4py processor module. ........ r14439 | bugman | 2011-08-25 12:19:59 +0200 (Thu, 25 Aug 2011) | 6 lines Reverted r14438 as the code actually was used. The command used was: svn merge -r14438:14437 . ........ r14440 | bugman | 2011-08-25 12:22:17 +0200 (Thu, 25 Aug 2011) | 3 lines Some cleaning up of the mpi4py processor module. ........ r14441 | bugman | 2011-08-25 12:24:18 +0200 (Thu, 25 Aug 2011) | 6 lines Reverted r14437 as _sys_exit is necessary for the mpi4py processor module. The command used was: svn merge -r14437:14436 . ........ r14442 | bugman | 2011-08-25 12:26:31 +0200 (Thu, 25 Aug 2011) | 3 lines Fix for the pymol.write user function - the file name can be set to None! ........ r14446 | bugman | 2011-08-25 12:53:45 +0200 (Thu, 25 Aug 2011) | 3 lines Fix for the GUI test mode - the mode variable should be a class variable. ........ r14447 | bugman | 2011-08-25 12:55:11 +0200 (Thu, 25 Aug 2011) | 5 lines Some more fixes for the 'mode' class variable. These problems were due to the multi-processor code merger. ........ Modified: branches/inversion-recovery/ (props changed) branches/inversion-recovery/multi/mpi4py_processor.py branches/inversion-recovery/multi/multi_processor_base.py branches/inversion-recovery/multi/processor.py branches/inversion-recovery/multi/uni_processor.py branches/inversion-recovery/prompt/pymol_control.py branches/inversion-recovery/relax.py branches/inversion-recovery/relax_errors.py branches/inversion-recovery/specific_fns/model_free/multi_processor_commands.py Propchange: branches/inversion-recovery/ ------------------------------------------------------------------------------ --- svnmerge-integrated (original) +++ svnmerge-integrated Thu Aug 25 14:43:50 2011 @@ -1,1 +1,1 @@ -/1.3:1-14425 +/1.3:1-14449 Modified: branches/inversion-recovery/multi/mpi4py_processor.py URL: http://svn.gna.org/viewcvs/relax/branches/inversion-recovery/multi/mpi4py_processor.py?rev=14450&r1=14449&r2=14450&view=diff ============================================================================== --- branches/inversion-recovery/multi/mpi4py_processor.py (original) +++ branches/inversion-recovery/multi/mpi4py_processor.py Thu Aug 25 14:43:50 2011 @@ -60,9 +60,12 @@ break -# wrapper sys.exit function -# CHECKME is status ok def exit(status=None): + """Wrapper for the sys.exit function.""" + + # CHECKME is status ok + + # Execution on the slave. if MPI.COMM_WORLD.rank != 0: if in_main_loop: raise Exception('sys.exit unexpectedley called on slave!') @@ -75,10 +78,10 @@ sys.__stderr__.write('***********************************************\n') sys.__stderr__.write('\n') MPI.COMM_WORLD.Abort() + + # Execution on the master. else: - #print 'here' exit_mpi() - #MPI.COMM_WORLD.Abort(1) _sys_exit(status) @@ -86,6 +89,7 @@ if MPI.Is_initialized() and not MPI.Is_finalized() and MPI.COMM_WORLD.rank == 0: broadcast_command(Exit_command()) ditch_all_results() + class Mpi4py_processor(Multi_processor): Modified: branches/inversion-recovery/multi/multi_processor_base.py URL: http://svn.gna.org/viewcvs/relax/branches/inversion-recovery/multi/multi_processor_base.py?rev=14450&r1=14449&r2=14450&view=diff ============================================================================== --- branches/inversion-recovery/multi/multi_processor_base.py (original) +++ branches/inversion-recovery/multi/multi_processor_base.py Thu Aug 25 14:43:50 2011 @@ -1,6 +1,7 @@ ############################################################################### # # # Copyright (C) 2007 Gary S Thompson (https://gna.org/users/varioustoxins) # +# Copyright (C) 2011 Edward d'Auvergne # # # # This file is part of the program relax. # # # @@ -144,8 +145,6 @@ def post_run(self): - - self.restore_stdio() super(Multi_processor, self).post_run() Modified: branches/inversion-recovery/multi/processor.py URL: http://svn.gna.org/viewcvs/relax/branches/inversion-recovery/multi/processor.py?rev=14450&r1=14449&r2=14450&view=diff ============================================================================== --- branches/inversion-recovery/multi/processor.py (original) +++ branches/inversion-recovery/multi/processor.py Thu Aug 25 14:43:50 2011 @@ -430,10 +430,6 @@ self._processor_size = processor_size '''Number of slave processors available in this processor.''' - # Default STDOUT and STDERR for restoring later on. - self.orig_stdout = sys.__stdout__ - self.orig_stderr = sys.__stderr__ - # Capture the STDIO. self.setup_stdio_capture(stdio_capture) @@ -677,21 +673,6 @@ ''' return int(math.ceil(math.log10(self.processor_size()))) - - - def restore_stdio(self): - '''Restore sys.stdout and sys.stderr to the system defaults. - - @note: sys.stdout and sys.stderr are replaced with sys.__stdout__ ans sys.__stderr__. - ''' - - # First flush. - sys.stdout.flush() - sys.stderr.flush() - - # Then restore the IO streams. - sys.stdout = self.orig_stdout - sys.stderr = self.orig_stderr def return_object(self, result): Modified: branches/inversion-recovery/multi/uni_processor.py URL: http://svn.gna.org/viewcvs/relax/branches/inversion-recovery/multi/uni_processor.py?rev=14450&r1=14449&r2=14450&view=diff ============================================================================== --- branches/inversion-recovery/multi/uni_processor.py (original) +++ branches/inversion-recovery/multi/uni_processor.py Thu Aug 25 14:43:50 2011 @@ -1,7 +1,7 @@ ############################################################################### # # # Copyright (C) 2007 Gary S Thompson (https://gna.org/users/varioustoxins) # -# Copyright (C) 2010 Edward d'Auvergne # +# Copyright (C) 2010-2011 Edward d'Auvergne # # # # This file is part of the program relax. # # # @@ -111,10 +111,6 @@ def return_object(self, result): - local_save_stdout = sys.stdout - local_save_stderr = sys.stderr - self.restore_stdio() - if isinstance(result, Exception): #FIXME: clear command queue # and finalise mpi (or restart it if we can! @@ -132,8 +128,6 @@ else: message = 'Unexpected result type \n%s \nvalue%s' %(result.__class__.__name__, result) raise Exception(message) - sys.stdout = local_save_stdout - sys.stderr = local_save_stderr def run(self): @@ -152,9 +146,7 @@ for i, command in enumerate(self.command_queue): completed = (i == last_command) - self.capture_stdio(self.std_stdio_capture(pre_strings=('', ''))) command.run(self, completed) - self.restore_stdio() #self.run_command_queue() #TODO: add cheques for empty queues and maps if now warn Modified: branches/inversion-recovery/prompt/pymol_control.py URL: http://svn.gna.org/viewcvs/relax/branches/inversion-recovery/prompt/pymol_control.py?rev=14450&r1=14449&r2=14450&view=diff ============================================================================== --- branches/inversion-recovery/prompt/pymol_control.py (original) +++ branches/inversion-recovery/prompt/pymol_control.py Thu Aug 25 14:43:50 2011 @@ -321,7 +321,7 @@ arg_check.is_str_or_num_list(colour_start, 'starting colour of the linear gradient', size=3, can_be_none=True) arg_check.is_str_or_num_list(colour_end, 'ending colour of the linear gradient', size=3, can_be_none=True) arg_check.is_str(colour_list, 'colour list', can_be_none=True) - arg_check.is_str_or_inst(file, 'file name') + arg_check.is_str_or_inst(file, 'file name', can_be_none=True) arg_check.is_str(dir, 'directory name', can_be_none=True) arg_check.is_bool(force, 'force flag') Modified: branches/inversion-recovery/relax.py URL: http://svn.gna.org/viewcvs/relax/branches/inversion-recovery/relax.py?rev=14450&r1=14449&r2=14450&view=diff ============================================================================== --- branches/inversion-recovery/relax.py (original) +++ branches/inversion-recovery/relax.py Thu Aug 25 14:43:50 2011 @@ -214,7 +214,7 @@ runner.run_unit_tests() # Execute the relax GUI tests. - elif mode == 'GUI tests': + elif self.mode == 'GUI tests': # Run the tests. runner = Test_suite_runner(self.tests) runner.run_gui_tests() @@ -229,7 +229,7 @@ # Unknown mode. else: - raise relax_errors.RelaxError("The '%s' mode is unknown." % mode) + raise relax_errors.RelaxError("The '%s' mode is unknown." % self.mode) def arguments(self): @@ -351,7 +351,7 @@ elif options.unit_tests: self.mode = 'unit tests' elif options.gui_tests: - mode = 'GUI tests' + self.mode = 'GUI tests' # Set the status flag. status.test_mode = True Modified: branches/inversion-recovery/relax_errors.py URL: http://svn.gna.org/viewcvs/relax/branches/inversion-recovery/relax_errors.py?rev=14450&r1=14449&r2=14450&view=diff ============================================================================== --- branches/inversion-recovery/relax_errors.py (original) +++ branches/inversion-recovery/relax_errors.py Thu Aug 25 14:43:50 2011 @@ -36,6 +36,7 @@ import time from types import ClassType + # Text variables. BIN = 'a binary number (0 or 1)' BOOL = 'a Boolean (True or False)' @@ -98,6 +99,7 @@ """Modify the behaviour of the error system.""" # Save the state if the pedantic flag is turned on. + from status import Status; status = Status() if status.pedantic: save_state() Modified: branches/inversion-recovery/specific_fns/model_free/multi_processor_commands.py URL: http://svn.gna.org/viewcvs/relax/branches/inversion-recovery/specific_fns/model_free/multi_processor_commands.py?rev=14450&r1=14449&r2=14450&view=diff ============================================================================== --- branches/inversion-recovery/specific_fns/model_free/multi_processor_commands.py (original) +++ branches/inversion-recovery/specific_fns/model_free/multi_processor_commands.py Thu Aug 25 14:43:50 2011 @@ -1,7 +1,7 @@ ############################################################################### # # # Copyright (C) 2007 Gary S Thompson (https://gna.org/users/varioustoxins) # -# Copyright (C) 2008, 2010 Edward d'Auvergne # +# Copyright (C) 2008-2011 Edward d'Auvergne # # # # This file is part of the program relax. # # # @@ -134,15 +134,7 @@ # Disassemble the results list. param_vector, func, iter, fc, gc, hc, warning = results - # Get the STDOUT and STDERR messages. - #FIXME: we need to interleave stdout and stderr - (stdout, stderr)= processor.get_stdio_capture() - result_string = stdout.getvalue() + stderr.getvalue() - stdout.truncate(0) - stderr.truncate(0) - processor.return_object(MF_result_command(processor, self.memo_id, param_vector, func, iter, fc, gc, hc, warning, completed=False)) - processor.return_object(Result_string(processor, result_string, completed=completed)) # An error occurred. except Exception, e :