Changeset 79

Show
Ignore:
Timestamp:
08/18/07 01:14:34 (1 year ago)
Author:
edsuom
Message:

New asynqueue.jobs and .processworker stuff now in trunk; asyncluster.master using it instead of its own .jobs

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • projects/AsynCluster/trunk/asyncluster/master/control.py

    r2 r79  
    2727from twisted.spread import pb 
    2828 
    29 import database, jobs 
     29from asynqueue import jobs 
     30import database 
    3031 
    3132 
     
    201202            return ID 
    202203         
    203         return self.jobber.attachNode(nodeRoot).addCallback(gotID) 
     204        return self.jobber.attachChild(nodeRoot).addCallback(gotID) 
    204205     
    205206    def detachNode(self, ID): 
     
    209210        """ 
    210211        self.nodes.pop(ID, None) 
    211         d = self.jobber.detachNode(ID) 
     212        d = self.jobber.detachChild(ID) 
    212213        if hasattr(self, 'sessionManager'): 
    213214            d.addCallback( 
  • projects/AsynCluster/trunk/asyncluster/master/test/mock.py

    r2 r79  
    5151        self.attached = {} 
    5252         
    53     def attachNode(self, nodeRoot): 
     53    def attachChild(self, nodeRoot): 
    5454        self.counter += 1 
    5555        self.attached[self.counter] = nodeRoot 
    5656        return defer.succeed(self.counter) 
    5757     
    58     def detachNode(self, ID): 
     58    def detachChild(self, ID): 
    5959        del self.attached[ID] 
    6060 
  • projects/AsynQueue/trunk/asynqueue/base.py

    r55 r79  
    229229        """ 
    230230        return self.mgr.hire(worker) 
     231 
     232    def _getWorkerID(self, workerOrID): 
     233        if workerOrID in self.mgr.workers: 
     234            return workerOrID 
     235        for thisID, worker in self.mgr.workers.iteritems(): 
     236            if worker == workerOrID: 
     237                return thisID 
     238        raise ValueError("No such worker") 
    231239     
    232240    def detachWorker(self, workerOrID, reassign=False, crash=False): 
     
    245253                self.mgr.assignment(task) 
    246254 
    247         if workerOrID in self.mgr.workers: 
    248             ID = workerOrID 
    249         else: 
    250             for thisID, worker in self.mgr.workers.iteritems(): 
    251                 if worker == workerOrID: 
    252                     ID = thisID 
    253                     break 
    254         if 'ID' not in locals(): 
    255             raise ValueError("No such worker to detach") 
     255        ID = self._getWorkerID(workerOrID) 
    256256        if crash: 
    257257            d = self.mgr.terminate(ID, crash=True) 
     
    261261            d.addCallback(terminated) 
    262262        return d 
     263 
     264    def qualifyWorker(self, worker, series): 
     265        """ 
     266        Adds the specified I{series} to the qualifications of the supplied 
     267        I{worker}. 
     268        """ 
     269        if series not in worker.iQualified: 
     270            worker.iQualified.append(series) 
     271            self.mgr.assignmentFactory.request(worker, series) 
    263272     
    264273    def workers(self, ID=None): 
  • projects/AsynQueue/trunk/asynqueue/workers.py

    r76 r79  
    217217    C{callRemote} tasks, no more than I{N} at a time, to a particular 
    218218    I{remoteReference} to a referenceable at a connected PB server. 
     219 
     220    @ivar remoteCaller: The I{callRemote} method of the remoteReference. 
     221     
    219222    """ 
    220223    implements(IWorker) 
  • projects/AsynQueue/trunk/setup.py

    r55 r79  
    3030 
    3131### Define setup options 
    32 kw = {'version':'0.1', 
     32kw = {'version':'0.2', 
    3333      'license':'GPL', 
    3434      'platforms':'OS Independent', 
     
    6262""".split("\n")) 
    6363 
    64 kw['long_description'] = """ 
     64kw['long_description'] = " ".join(""" 
    6565Asynchronous task queueing based on the Twisted framework, with task 
    66 prioritization and a powerful worker/manager interface. 
    67  
    68 Worker implementations are included for running tasks via threads, separate 
    69 Python interpreters, and remote worker nodes. 
    70 """ 
     66prioritization and a powerful worker/manager interface. Worker implementations 
     67are included for running tasks via threads, separate Python interpreters, and 
     68remote worker nodes. 
     69""".split("\n")) 
    7170 
    7271### Finally, run the setup