Esempio n. 1
0
 def __init__(self, server_endpoint, store_name):
     self.app = rpcz.Application()
     self.iserver = index_rpcz.IndexQueryService_Stub(
         self.app.create_rpc_channel(server_endpoint))
     store = index_pb.UseStore()
     store.location = store_name
     try:
         self.iserver.useStore(store, deadline_ms=3)
     except rpcz.RpcDeadlineExceeded:
         try:
             self.iserver.useStore(store, deadline_ms=4)
         except rpcz.RpcDeadlineExceeded:
             self.iserver.useStore(store, deadline_ms=5)
Esempio n. 2
0
    def run(self):
        app = rpcz.Application()
        server = rpcz.Server(app)

        for service in self.services:
            print "registering service: " + str(
                service.__class__.__name__) + " as rpcz service: " + str(
                    service.DESCRIPTOR.name)
            rospy.loginfo("registering service: " +
                          str(service.__class__.__name__) +
                          " as rpcz service: " + str(service.DESCRIPTOR.name))
            server.register_service(service, service.DESCRIPTOR.name)

        server.bind(self.server_address)
        rospy.loginfo("Serving requests on port " + str(self.server_address))
        app.run()
Esempio n. 3
0
                    type=int,
                    default=0,
                    help='skip this number of articles')
parser.add_argument('--empty',
                    action='store_true',
                    default=False,
                    help='empty database')
args = parser.parse_args()

##
# Initialising index-store
if not args.disable_index:
    ISERVER_ADDRESS = 'tcp://localhost:5555'
    STORE_NAME = 'enwiki'

    app = rpcz.Application()
    iserver = index_rpcz.IndexBuilderService_Stub(
        app.create_rpc_channel(ISERVER_ADDRESS))
    store = index_pb.StoreParameters()
    store.location = STORE_NAME
    if args.empty:
        store.overwrite = True
        iserver.createStore(store, deadline_ms=1)
    else:
        store.overwrite = False
        iserver.openStore(store, deadline_ms=1)

##
# Initialising MongoDB
if not args.disable_mongo:
    with open(args.mongocred, 'rt') as f: