<commit_before>"""
    This command publishes a message to the event system for
    debugging perposes.
"""

# external imports
import click
import asyncio
import json
from aiokafka import AIOKafkaProducer

@click.option('--type', default='cli', help="The action type of the action to publish.")
@click.option('--payload', help="The payload of the message")
@click.command()
def publish(type, payload):
    """
        Publish a message with the specified action_type and payload over the
        event system. Useful for debugging.
    """
    async def _produce(loop):
        # the message payload
        message = json.dumps({
            'action_type': type,
            'payload': payload
        }).encode()

        # adds message to sending queue
        future = await producer.send('actions', message)
        # waiting for message to be delivered
        r = await future

        # notify the user
        print("Successfully published action to services.")

    # grab a reference to the current event loop
    loop = asyncio.get_event_loop()
    # create a producer
    producer = AIOKafkaProducer(loop=loop, bootstrap_servers='localhost:9092')<commit_msg>added publish cli ; resolves #95<commit_after>"""
    This command publishes a message to the event system for
    debugging perposes.
"""

# external imports
import click
import asyncio
import json
from aiokafka import AIOKafkaProducer

@click.option('--type', '-t', default='cli', help="The action type of the action to publish.")
@click.option('--payload', '-p', required=True, help="The payload of the message")
@click.command()
def publish(type, payload):
    """
        Publish a message with the specified action_type and payload over the
        event system. Useful for debugging.
    """
    async def _produce(loop):
        # the message payload
        message = json.dumps({
            'action_type': type,
            'payload': payload
        }).encode()

        # adds message to sending queue
        future = await producer.send('actions', message)
        # waiting for message to be delivered
        r = await future

        # notify the user
        print("Successfully published action to services.")

    # grab a reference to the current event loop
    loop = asyncio.get_event_loop()
    # create a producer
    producer = AIOKafkaProducer(loop=loop, bootstrap_servers='localhost:9092')
{'fraction_non_alphanumeric': 0.09456066945606695, 'fraction_numerical': 0.0041841004184100415, 'mean_word_length': 2.9261083743842367, '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': '7135175', 'n_tokens_mistral': 630, 'n_tokens_neox': 618, 'n_words': 238}