mailr27845 - /trunk/multi/processor.py


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

Header


Content

Posted by tlinnet on May 27, 2015 - 03:10:
Author: tlinnet
Date: Wed May 27 03:09:59 2015
New Revision: 27845

URL: http://svn.gna.org/viewcvs/relax?rev=27845&view=rev
Log:
Suggestion for fix 2, where jobs are continously replenished when other jobs 
are finished.

Bug #23618: (https://gna.org/bugs/index.php?23618): queuing system for multi 
processors is not well designed.

Modified:
    trunk/multi/processor.py

Modified: trunk/multi/processor.py
URL: 
http://svn.gna.org/viewcvs/relax/trunk/multi/processor.py?rev=27845&r1=27844&r2=27845&view=diff
==============================================================================
--- trunk/multi/processor.py    (original)
+++ trunk/multi/processor.py    Wed May 27 03:09:59 2015
@@ -585,6 +585,8 @@
 
         running_set = set()
         idle_set = set([i for i in range(1, self.processor_size()+1)])
+        all_jobs = list(reversed(xrange(1, len(queue)+1)))
+        completed_jobs = []
 
         if self.threaded_result_processing:
             result_queue = Threaded_result_queue(self)
@@ -606,8 +608,9 @@
             while len(running_set) != 0:
                 # Debugging printout.
                 if verbosity.level():
-                    print('\nIdle set:    %s' % idle_set)
-                    print('Running set: %s' % running_set)
+                    print('\n')
+                    print('Running nr of jobs: %i' % len(running_set))
+                    print('Completed jobs: %s' % len(completed_jobs))
 
                 # Get the result.
                 result = self.master_receive_result()
@@ -616,6 +619,13 @@
                 if result.completed:
                     idle_set.add(result.rank)
                     running_set.remove(result.rank)
+                    completed_jobs.append(all_jobs.pop())
+                    if len(queue) != 0:
+                        # Add new to que
+                        command = queue.pop()
+                        dest = result.rank
+                        self.master_queue_command(command=command, dest=dest)
+                        running_set.add(dest)
 
                 # Add to the result queue for instant or threaded processing.
                 result_queue.put(result)




Related Messages


Powered by MHonArc, Updated Thu May 28 18:20:22 2015