当前位置: 首页>>代码示例>>Python>>正文


Python rpc.make_client函数代码示例

本文整理汇总了Python中thriftpy.rpc.make_client函数的典型用法代码示例。如果您正苦于以下问题:Python make_client函数的具体用法?Python make_client怎么用?Python make_client使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了make_client函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: get_nimbus_client

def get_nimbus_client(env_config=None, host=None, port=None, timeout=7000):
    """Get a Thrift RPC client for Nimbus given project's config file.

    :param env_config: The project's parsed config.
    :type env_config: `dict`
    :param host: The host to use for Nimbus.  If specified, `env_config` will
                 not be consulted.
    :type host: `str`
    :param port: The port to use for Nimbus.  If specified, `env_config` will
                 not be consulted.
    :type port: `int`
    :param timeout: The time to wait (in milliseconds) for a response from
                    Nimbus.
    :param timeout: `int`

    :returns: a ThriftPy RPC client to use to communicate with Nimbus
    """
    if host is None:
        host, port = get_nimbus_host_port(env_config)
    nimbus_client = make_client(
        Nimbus,
        host=host,
        port=port,
        proto_factory=TBinaryProtocolFactory(),
        trans_factory=TFramedTransportFactory(),
        timeout=timeout,
    )
    return nimbus_client
开发者ID:Parsely,项目名称:streamparse,代码行数:28,代码来源:util.py

示例2: client

    def client(self):
        client = make_client(
            publication_stats_thrift.PublicationStats,
            self._address,
            self._port
        )

        return client
开发者ID:fabiobatalha,项目名称:processing,代码行数:8,代码来源:clients.py

示例3: re_init

def re_init():
  try:
    global client
    client = make_client(broker_thrift.TradeService, config.BROKER_HOST, config.BROKER_PORT,
                           proto_factory=TBinaryProtocolFactory(),
                           trans_factory=TFramedTransportFactory(),
                           timeout=60000)  
  except Exception as e:
    logging.warn("make_client exception")
    traceback.print_exc()
开发者ID:caojun105,项目名称:bitcoin-arbitrage,代码行数:10,代码来源:broker_api.py

示例4: main

def main():
    host            = '127.0.0.1' if len(sys.argv) < 2 else sys.argv[1]
    port            = 9090 if len(sys.argv) < 3 else int(sys.argv[2])
    uniqueid_thrift = thriftpy.load('../protocol/uniqueid.thrift', module_name='uniqueid_thrift')
    client          = make_client(uniqueid_thrift.Uniqueid, host, port)
    request         = uniqueid_thrift.UniqueidRequest()
    request.logid   = random.randint(-2147483648, 2147483647)
    request.serial  = random.randint(0, 9)
    request.length  = random.randint(1, 10)
    response        = client.uniqueid(request)
    print(response)
开发者ID:hatlonely,项目名称:crystal,代码行数:11,代码来源:uniqueid_client.py

示例5: write_multiple

 def write_multiple(self, spans):
     entries = [self.__span_to_entry(span) for span in spans]
     # TODO(will): The old implementation used to open and close transport here, with the new
     # client based API this seems like the only way to get parity. Not sure if we would rather
     # try persistent connections + reconnecting in the long run.
     client = make_client(scribe_thrift.scribe,
                          host=self.host,
                          port=self.port,
                          timeout=self.timeout,
                          proto_factory=self.protocol_factory,
                          trans_factory=self.transport_factory)
     client.Log(entries)
     client.close()
开发者ID:thought-machine,项目名称:python-zipkin,代码行数:13,代码来源:scribe_writer.py

示例6: __init__

  def __init__(self):
    # We need to run a FrontendService server, even though it does nothing in
    # practice
    fes = make_server(sparrow_service_thrift.FrontendService,
                      FLAGS.sparrow_frontend_host, FLAGS.sparrow_frontend_port,
                      trans_factory=tf)
    self.scheduler_client = make_client(sparrow_service_thrift.SchedulerService,
                                        FLAGS.sparrow_scheduler_host,
                                        FLAGS.sparrow_scheduler_port,
                                        trans_factory=tf)

    self.scheduler_client.registerFrontend("clusterMixApp",
                                           FLAGS.sparrow_frontend_host + ":" +
                                           str(FLAGS.sparrow_frontend_port))
开发者ID:ms705,项目名称:firmament-experiments,代码行数:14,代码来源:sparrow_cluster_mix_network.py

示例7: handleClient

def handleClient(num, actual):
    # Open independent client connection
    client = make_client(service=echo_thrift.Echo, host='127.0.0.1',
                         port=9999, trans_factory=TFramedTransportFactory())

    # UUID
    uid = str(uuid4())

    for i in range(num):
        # Make thrift call and increment atomic count
        txt = uid + str(i)
        ret = client.echo(echo_thrift.Message(text=txt))
        if (txt == ret):
            with actual.get_lock():
                actual.value += 1
开发者ID:ryyan,项目名称:thrift-benchmark,代码行数:15,代码来源:client.py

示例8: start_client

def start_client():
    while True:
        while True:
            try:
                client = make_client(thrift_service.Ping, 'localhost', 9000)
                break
            except:
                continue

        while True:
            try:
                pong = client.ping()
            except:
                break
            print(pong)
            time.sleep(1)
        continue
开发者ID:12z,项目名称:Raft,代码行数:17,代码来源:main.py

示例9: getClient

def getClient():
    wwfAPIpathname = os.path.join('thrift', 'wwf_api.thrift')
    wwfAPI_thrift = thriftpy.load(path=wwfAPIpathname, module_name='wwfAPI_thrift', include_dirs=['thrift'])
    tTransport = TFramedTransportFactory()
    client = make_client(wwfAPI_thrift.WwfApi, port=9090, trans_factory=tTransport)
    return client
开发者ID:Damien-Black,项目名称:foxier,代码行数:6,代码来源:makerequest.py

示例10: make_client

#!/usr/bin/env python
# coding: utf-8

import os
import thriftpy

from thriftpy.rpc import make_client


# Examples using thrift
if __name__ == '__main__':

    citedby_thrift = thriftpy.load(os.path.join(os.path.dirname(
                                   os.path.abspath(__file__)), 'citedby.thrift'))

    client = make_client(citedby_thrift.Citedby, 'localhost', 11610)

    print client.citedby_pid('S1516-89132010000300001', False)

    print client.citedby_doi('10.1590/S1516-89132010000300001')

    print client.citedby_meta(title='Biochemical and morphological changes during the growth kinetics of Araucaria angustifolia suspension cultures')
开发者ID:swarzesherz,项目名称:citedby,代码行数:22,代码来源:client_sample.py

示例11: rpc_call

def rpc_call(call, server, *args):
    client = make_client(lang_thrift.CodeExecutor, *server)
    return getattr(client, call)(*args)
开发者ID:jamesmkwan,项目名称:cse191,代码行数:3,代码来源:client.py

示例12: mk_client

 def mk_client(self):
     return make_client(addressbook.AddressBookService,
                        '127.0.0.1', self.port,
                        proto_factory=self.PROTOCOL_FACTORY,
                        trans_factory=self.TRANSPORT_FACTORY)
开发者ID:AllanDaemon,项目名称:thriftpy,代码行数:5,代码来源:test_framed_transport.py

示例13: make_client

import thriftpy
pingpong_thrift = thriftpy.load("pingpong.thrift", module_name="pingpong_thrift")

from thriftpy.rpc import make_client

client = make_client(pingpong_thrift.PingPong, '127.0.0.1', 6000)
client.ping()
开发者ID:ahjdzx,项目名称:python_work,代码行数:7,代码来源:client.py

示例14: send_to_taskqueue

def send_to_taskqueue(task, task_id, ip, port):
    client = make_client(enqueue_thrift.RPC, ip, port)
    client.task_service(task, task_id)
开发者ID:ayush--s,项目名称:taskqueue,代码行数:3,代码来源:taskqueue.py

示例15: make_client

#!/usr/bin/env python
# -*- coding: utf-8 -*-

import thriftpy
from thriftpy.rpc import make_client

pingpong_thrift = thriftpy.load("pingpong.thrift", module_name="pingpong_thrift")

client = make_client(pingpong_thrift.PingPong, '0.0.0.0', 6000)
print client.ping()
开发者ID:MrKiven,项目名称:process_monitor,代码行数:10,代码来源:simple_client_by_thriftpy.py


注:本文中的thriftpy.rpc.make_client函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。