Skip to content

Instantly share code, notes, and snippets.

@jrzaurin
Last active March 9, 2019 12:14
Show Gist options
  • Save jrzaurin/4ffafc335c3f319f1393d141bed3e78c to your computer and use it in GitHub Desktop.
Save jrzaurin/4ffafc335c3f319f1393d141bed3e78c to your computer and use it in GitHub Desktop.
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