Beispiel #1
0
    def runsource(self, source, filename="<input>", symbol="single"):
        logging.debug('Enter, source=%r.', source)

        more, output = rfoo.Proxy(self.conn).runsource(source, filename)
        if output:
            self.write(output)

        return more
Beispiel #2
0
    def complete(self, phrase, state):
        """Auto complete support for interactive console."""
        
        logging.debug('Enter, phrase=%r, state=%d.', phrase, state)

        # Allow tab key to simply insert spaces when proper.
        if phrase == '':
            if state == 0:
                return '    '
            return None

        return rfoo.Proxy(self.conn).complete(phrase, state)
Beispiel #3
0
        def client():
            #
            # Time connection setup/teardown.
            #
            if '-c' in options:
                for i in range(m):
                    connection = rfoo.connect(host=host, port=port)
                    r = rfoo.Proxy(connection).echo(data)
                    if level == logging.DEBUG:
                        logging.debug('Received %r from proxy.', r)
                    connection.close()

            #
            # Time with dummy connection (no network).
            #
            elif '-u' in options:
                handler = rfoo.ExampleHandler()
                dummy = DummyConnection(handler)
                echo = gate(dummy).echo
                for i in range(m):
                    r = echo(data)
                    if level == logging.DEBUG:
                        logging.debug('Received %r from proxy.', r)

            #
            # Time calls synched / asynch (notifications).
            #
            else:
                connection = rfoo.connect(host=host, port=port)
                echo = gate(connection).echo
                for i in range(m):
                    r = echo(data)
                    #if level == logging.DEBUG:
                    #    logging.debug('Received %r from proxy.', r)

            logging.warning('Received %r from proxy.', r)
Beispiel #4
0
            print "error: -c and -i are exclusive"
            usage()
        commands_queue = Queue()
        results_queue = Queue()
        master = Master(commands_queue, results_queue, options.begin_command,
                        options.end_command)
        nb_jobs = 0
        locks = []
        if is_server:
            rfoo.start_server(host='',
                              port=int(options.server_port),
                              handler=Master)  # CC
        if connect_to_server:
            handler = rfoo.connect(host=remote_server_name,
                                   port=int(options.server_port))  # CC
            master = rfoo.Proxy(handler)

        # start workers
        for i in range(nb_threads):
            l = thread.allocate_lock()
            l.acquire()
            locks.append(l)
            time.sleep(0.01)  # dirty bug correction:
            # on multiproc machines, starting threads without
            # waiting makes Pyro output this sometimes:
            # "Pyro.errors.ProtocolError: unknown object ID"
            # It is like if the Pyro daemon is not ready yet
            # to handle many new client threads...
            # CC: is it still necessary with rfoo instead of Pyro?
            thread.start_new_thread(worker_wrapper, (master, l))
        # feed workers