Commits

wl...@4525493e-7705-40b1-a816-d608a930855b  committed 9863666

further exit code propagation and handling

  • Participants
  • Parent commits ccccd9f

Comments (0)

Files changed (3)

+2012-01-18  Wim Lavrijsen <WLavrijsen@lbl.gov>
+        * More exit code handling: different paths through PyComps give completely different
+          results. (Note that the current multiprocessing based code hangs, crashes, or does
+          whatever.) Adiabatic expansion still disabled.
+
 2012-01-17  Wim Lavrijsen <WLavrijsen@lbl.gov>
         * Finalized some of the worker return handling (still following the old reporting
           style, even as it is no longer necessary). Adiabatic expansion still disabled.

File python/MpProcessing.py

 
         result = []
         for proc_result in status:
-            r = proc_result[ 2 ]
-            if ( r[0][2] == 0 ): r[0] = ( r[0][0], r[0][1], proc_result[1], r[0][3] )
-            if ( r[1][2] == 0 ): r[1] = ( r[1][0], r[1][1], proc_result[1], r[1][3] )
-            result.append( proc_result[ 2 ] )
+        # The result from run_worker_queue is extremely circumspect: it can either
+        # contain a single tuple of 5 entries, 1 tuple of 4 entries, or 2 tuples of
+        # 4 entries. It is checked on being 'OK' on the last entry of each tuple.
+        # By sheer coincidence, that happens to work.
+
+        # Now, the tuple can not be edited, so it's turned into a list, which takes
+        # care of the spurious arrangement of lengths. Then for all possible returns,
+        # the third entry is always theApp._exitstate and may need modification.
+
+        # General exceptions are eaten, b/c this is so PyComps specific. :P
+             r = proc_result[ 2 ]  # the python-posted result
+             try:
+                 import types
+                 if type(r[0]) == types.TupleType:              # early return case
+                     z = [ list(y) for y in r ]
+                     for l2 in z:
+                         if l2[2] == 0: l2[2] = proc_result[1]
+                 else:
+                     z = [ [ list(y) for y in x ] for x in r ]  # late return case
+                     for l1 in z:
+                         for l2 in l1:
+                             if l2[2] == 0: l2[2] = proc_result[1]
+             except Exception:
+             # make-believe? can happen e.g. on early exit() or e.g. SIGQUIT
+                 r = [[(proc_result[0], -1, proc_result[1], 'ERR')]]
+             result.append( r )
         return result
 
 class Pool( object ):

File src/_athenamp/SharedQueue.cxx

 using namespace boost::interprocess;
 
 
-const std::size_t MAX_MSG_SIZE = 40960;
+const std::size_t MAX_MSG_SIZE = 4096;
 
 namespace AthenaMP {