<commit_before>from oslo import messaging
from oslo.config import cfg
import logging

LOG = logging.getLogger(__name__)

class BaseAPIClient(messaging.RPCClient):
    def __init__(self, transport):
        target = messaging.Target(topic='default_topic')
        super(BaseAPIClient, self).__init__(transport, target)

    def ping(self, context, topic, args=None):
        print 'Launch ping topic=%s' % topic
        cctxt = self.prepare(topic=topic)
        #return cctxt.call(context,'ping', args=args)
        return cctxt.cast(context,'ping', args=args)

    def poller_msg(self, context, topic, args=None):
        LOG.info('Send message %s context %s' % (topic, context))
        cctxt = self.prepare(topic=topic)
        return cctxt.cast(context,'poller_msg', args=args)

def get_rpc_client(hosts=[]):
    conf = cfg.CONF
    conf.transport_url = 'rabbit://'
    conf.rabbit_max_retries = 1
    conf.rabbit_hosts = hosts
    transport = messaging.get_transport(conf)
    return BaseAPIClient(transport)<commit_msg>Change oslo client send prepare<commit_after>from oslo import messaging
from oslo.config import cfg
import logging

LOG = logging.getLogger(__name__)

class BaseAPIClient(messaging.RPCClient):
    def __init__(self, transport):
        target = messaging.Target(topic='default_topic')
        super(BaseAPIClient, self).__init__(transport, target)

    def ping(self, context, topic, args=None):
        print 'Launch ping topic=%s' % topic
        cctxt = self.prepare(topic=topic)
        #return cctxt.call(context,'ping', args=args)
        return cctxt.cast(context,'ping', args=args)

    def poller_msg(self, context, topic, args=None):
        LOG.info('Send message %s context %s' % (topic, context))
        args['topic'] = topic
        return self.cast(context,'poller_msg', args=args)

def get_rpc_client(hosts=[]):
    conf = cfg.CONF
    conf.transport_url = 'rabbit://'
    conf.rabbit_max_retries = 1
    conf.rabbit_hosts = hosts
    transport = messaging.get_transport(conf)
    return BaseAPIClient(transport)
{'fraction_non_alphanumeric': 0.11690209449585971, 'fraction_numerical': 0.000974184120798831, 'mean_word_length': 3.7990654205607477, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3284830', 'n_tokens_mistral': 640, 'n_tokens_neox': 630, 'n_words': 145}