Changeset 5087


Ignore:
Timestamp:
10/13/11 10:16:04 (3 years ago)
Author:
jwatson
Message:

Fixing issue with missing symbol map in Pyro interface.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • coopr.plugins/trunk/coopr/plugins/smanager/pyro.py

    r4936 r5087  
    4242        self._opt = None 
    4343        self._verbose = False 
    44         self._ah = {} 
     44        self._ah = {} # maps task ids to their corresponding action handle. 
     45        self._symbol_map = {} # maps task ids to the corresponding symbol map.  
    4546 
    4647    def _perform_queue(self, ah, *args, **kwds): 
     
    6162 
    6263        # 
    63         # Force coopr.opt to ignore tests for availability, at least locally 
     64        # Force coopr.opt to ignore tests for availability, at least locally. 
    6465        # 
    6566        kwds['available'] = True 
     
    7475 
    7576        # 
    76         # We can't pickl the options object itself - so extract a simple 
     77        # We can't pickle the options object itself - so extract a simple 
    7778        # dictionary of solver options and re-construct it on the other end. 
    7879        # 
     
    9192 
    9293        # 
    93         # Pickl everything into one big data object via the "Bunch" command 
     94        # Pickle everything into one big data object via the "Bunch" command 
    9495        # and post the task! 
    9596        # 
     
    100101 
    101102        task = pyutilib.pyro.Task(data=data, id=ah.id) 
    102         self.client.add_task(task, self._verbose) 
     103        self.client.add_task(task, verbose=self._verbose) 
    103104        self._ah[task.id] = ah 
     105        self._symbol_map[task.id] = self._opt._symbol_map 
    104106 
    105107        return ah 
     
    119121                task = self.client.get_result() 
    120122                if task.id in self._ah: 
     123 
    121124                    ah = self._ah[task.id] 
    122                     self._ah[task.id] = None 
     125                    del self._ah[task.id] 
     126 
     127                    symbol_map = self._symbol_map[task.id] 
     128                    del self._symbol_map[task.id] 
     129 
    123130                    ah.status = ActionStatus.done 
    124                     #print "HERE",ah.id, task.result 
     131 
    125132                    self.results[ah.id] = pickle.loads(task.result) 
    126                     #self.results[ah.id].write() 
     133 
     134                    # symbol maps don't pass across the Pyro interface (they 
     135                    # are not pickle-able), so tag the results object with 
     136                    # the cached symbol map. 
     137                    self.results[ah.id]._symbol_map = symbol_map 
     138 
    127139                    return ah 
    128140 
Note: See TracChangeset for help on using the changeset viewer.