Last active
March 9, 2019 12:14
-
-
Save jrzaurin/4ffafc335c3f319f1393d141bed3e78c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def start(): | |
consumer = KafkaConsumer(RETRAIN_TOPIC, bootstrap_servers=KAFKA_HOST) | |
for msg in consumer: | |
message = json.loads(msg.value) | |
if 'retrain' in message and message['retrain']: | |
model_id = message['model_id'] | |
batch_id = message['batch_id'] | |
message_fname = 'messages_{}_.txt'.format(batch_id) | |
messages = MESSAGES_PATH/message_fname | |
train(model_id, messages) | |
publish_traininig_completed(model_id) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment