

def onexit():
    global kafka, consumer, producer
    if consumer:
        consumer.commit()
        consumer.stop()
        consumer = None
    if producer:
        producer.stop()
        producer = None
    if kafka:
        kafka.close()
        kafka = None
    print('remote_rainter {0} is shutting down'.format(os.getpid()))

dataset/ETHPy150Open xumiao/pymonk/tests/kafka_tester.py onexit/original