def get_idle_worker():
    doc = es.search_one_document(w_idx, es.missing_field_query("current_task_id"))
    if doc:
        worker = Worker.from_es_data(doc['_source'])
        worker_id = doc['_id']
        return worker, worker_id

    return None, None
예제 #2
0
def get_worker_by_id(worker_id):
    doc = es.get_document_by_id(w_idx, worker_id)
    if doc:
        return Worker.from_es_data(doc['_source'])

    return None