Пример #1
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)
Пример #2
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)
Пример #3
0
        # check options coherency
        if read_from_file and connect_to_server:
            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=host,
                              port=int(options.server_port),
                              handler=Master)  # CC
        if connect_to_server:
            master = rfoo.connect(host=remote_server_name,
                                  port=int(options.server_port))  # CC

        # 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
Пример #4
0
        if has_post_proc_option:
            module = __import__(post_proc_option)
            post_proc_fun = module.post_proc
        # check options coherency
        if read_from_file and connect_to_server:
            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))