Esempio n. 1
0
    def terminate(self):

        ## AbstractGrid.terminate:
        ##
        ## 1. prevents server from being acquired [AbstractGrid.terminate]
        ## 2. terminates server and its proxy:
        ##       AbstractGrid.terminate -> PyroServer.terminate ->
        ##       -> PyroProxy.terminate,
        ##       where PyroProxy.terminate does
        ##
        ## PyroGrid.terminate:
        ##
        ## 3. terminates handler [ PyroHandler.terminate ]

        self.check_published()

        AbstractGrid.terminate(self)

        for instance_uri, handler in self.handlers.items():

            try:
                handler._release()
                handler.terminate()
                self.handlers.pop(instance_uri)

            except Pyro.errors.PyroError,e:
                print  ''.join(Pyro.util.getPyroTraceback(e))
Esempio n. 2
0
    def __init__(self, hosts, src_path, display, X11_delay,
                 debug, verbose,
                 shared_temp_path, nshost, terminate_during_publish,
                 method='ssh'):

        AbstractGrid.__init__(self, hosts, src_path, display, X11_delay,\
                              debug, verbose, shared_temp_path)

        #copy remaining files specific for the pyrogrid
        self.initialise(src_path, ['PyroGrid','PyroUtils',
                                   'PyroHandlerLoader'])

        #set the pyro loader as the loader
        self.set_loader(src_path, 'PyroHandlerLoader')

        #method is either ssh or qsub
        if method != 'ssh' and method != 'qsub':
            raise ValueError, "unknown method: %s. Try ssh or qsub" % method
        self.method = method

        #number of hosts
        self.n_hosts = len(hosts)

        #name of the host having the pyro-ns nameserver
        self.nshost = nshost

        self.timeout = 60.0 ## (for WatchDog, in minutes)

        self.handlers = {}  ## maps instance (URI) to a handler (proxy)

        self.__terminate_during_publish = terminate_during_publish
        self.__published = {}

        self.comm_acquired = False

        self.__stopped = False