def get_experiment_by_name(exp_name):
    doc = es.search_one_document(e_idx,
                                 es.dict_query(flatten({'name': exp_name})))
    if doc:
        return doc['_id']

    return None
Exemplo n.º 2
0
 def flatten(self):
     return flatten({
         'assemble_config': self.assemble_config,
         'assemble_task_id': self.assemble_task_id,
         'learn_config': self.learn_config,
         'up_to_date': self.up_to_date,
     })
Exemplo n.º 3
0
def search_task_by_order(exp_id):
    doc = es.search_one_document(
        t_idx,
        es.dict_query(flatten({
            'experiment_id': exp_id,
            'state': "runnable"
        }), {'order_in_exp': {
            'order': 'asc'
        }}))
    if doc:
        return doc['_id'], Task.from_es_data(doc['_source'])

    return None, None
 def flatten(self):
     return flatten({
         'assemble_config': self.assemble_config,
         'up_to_date': self.up_to_date,
     })
Exemplo n.º 5
0
 def flatten(self):
     return flatten({
         'experiment_id': self.experiment_id,
         'assemble_task_id': self.assemble_task_id,
         'learn_task_id': self.learn_task_id,
     })
Exemplo n.º 6
0
def get_all_worker():
    return es.search_documents(w_idx, es.dict_query(flatten({'deleted':
                                                             False})),
                               Worker.from_es_data)
 def flatten(self):
     return flatten(self.to_dict())
Exemplo n.º 8
0
def delete_exp_tasks(exp_id):
    return es.delete_documents(
        t_idx, es.dict_query(flatten({'experiment_id': exp_id})))
Exemplo n.º 9
0
def get_all_task_by_dict(dict):
    return es.search_documents(t_idx, es.dict_query(flatten(dict)),
                               Task.from_es_data)
Exemplo n.º 10
0
def search_task_by_dict(dict):
    doc = es.search_one_document(t_idx, es.dict_query(flatten(dict)))
    if doc:
        return doc['_id'], Task.from_es_data(doc['_source'])

    return None, None