mailr15622 - in /1.3/multi: __init__.py processor.py test_implementation2.py


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

Header


Content

Posted by edward on March 23, 2012 - 17:54:
Author: bugman
Date: Fri Mar 23 17:54:42 2012
New Revision: 15622

URL: http://svn.gna.org/viewcvs/relax?rev=15622&view=rev
Log:
Renamed the multi-processor API data_fetch() function to fetch_data(), and 
implemented it.


Modified:
    1.3/multi/__init__.py
    1.3/multi/processor.py
    1.3/multi/test_implementation2.py

Modified: 1.3/multi/__init__.py
URL: 
http://svn.gna.org/viewcvs/relax/1.3/multi/__init__.py?rev=15622&r1=15621&r2=15622&view=diff
==============================================================================
--- 1.3/multi/__init__.py (original)
+++ 1.3/multi/__init__.py Fri Mar 23 17:54:42 2012
@@ -198,10 +198,10 @@
     return object
 
 
-def data_fetch(name=None):
+def fetch_data(name=None):
     """API function for obtaining data from the Processor instance's data 
store.
 
-    This is for fetching data from the data store of the Processor instance. 
 
+    This is for fetching data from the data store of the Processor instance. 
 If run on the master, then the master's data store will be accessed.  If run 
on the slave, then the slave's data store will be accessed.
 
 
     @keyword name:  The name of the data structure to fetch.
@@ -212,6 +212,9 @@
 
     # Load the Processor_box.
     processor_box = Processor_box()
+
+    # Forward the call to the processor instance.
+    return processor_box.processor.fetch_data(name=name)
 
 
 def send_data_to_slaves(name=None, value=None):

Modified: 1.3/multi/processor.py
URL: 
http://svn.gna.org/viewcvs/relax/1.3/multi/processor.py?rev=15622&r1=15621&r2=15622&view=diff
==============================================================================
--- 1.3/multi/processor.py (original)
+++ 1.3/multi/processor.py Fri Mar 23 17:54:42 2012
@@ -235,6 +235,25 @@
         """
 
 
+    def fetch_data(self, name=None):
+        """Fetch the data structure of the given name from the data store.
+
+        This can be run on the master or slave processors.
+
+
+        @keyword name:  The name of the data structure to fetch.
+        @type name:     str
+        @return:        The value of the associated data structure.
+        @rtype:         anything
+        """
+
+        # Get the object.
+        obj = getattr(self.data_store, name)
+
+        # Return the value.
+        return obj
+
+
     def send_data_to_slaves(self, name=None, value=None):
         """Transfer the given data from the master to all slaves.
 

Modified: 1.3/multi/test_implementation2.py
URL: 
http://svn.gna.org/viewcvs/relax/1.3/multi/test_implementation2.py?rev=15622&r1=15621&r2=15622&view=diff
==============================================================================
--- 1.3/multi/test_implementation2.py (original)
+++ 1.3/multi/test_implementation2.py Fri Mar 23 17:54:42 2012
@@ -34,7 +34,7 @@
 sys.path.append('..')
 
 # relax module imports.
-from multi import data_fetch, send_data_to_slaves, Application_callback, 
load_multiprocessor, Memo, Processor_box, Result_command, Slave_command
+from multi import fetch_data, send_data_to_slaves, Application_callback, 
load_multiprocessor, Memo, Processor_box, Result_command, Slave_command
 
 
 # Module variables.
@@ -165,7 +165,7 @@
         processor_box.processor.run_queue()
 
         # Calculate the average length.
-        ave_len = data_fetch('total_length') / self.N
+        ave_len = fetch_data('total_length') / self.N
 
         # Final program print out.
         print("\n\nTotal number of calculations: %s" % self.num)




Related Messages


Powered by MHonArc, Updated Fri Mar 23 18:00:01 2012