def queue_enable_item(): params = request.get_json() qidList, enabled = params.get("qidList", None), params.get("enabled", False) for qid in qidList: qutils.set_enabled_entry(qid, enabled) logging.getLogger('HWR').info('[QUEUE] is:\n%s ' % qutils.queue_to_json()) return Response(status=200)
def set_queue(): # Clear queue mxcube.diffractometer.savedCentredPos = [] mxcube.queue = qutils.new_queue() # Set new queue qutils.queue_add_item(request.get_json()) logging.getLogger('HWR').info('[QUEUE] is:\n%s ' % qutils.queue_to_json()) qutils.save_queue(session) return Response(status=200)
def execute_entry_with_id(sid, tindex): """ Execute the entry at position (sampleID, task index) in queue :param str sid: sampleID :param int tindex: task index of task within sample with id sampleID :statuscode: 200, no error 409, queue entry could not be executed """ try: qutils.execute_entry_with_id(sid, tindex) except: return Response(status=409) else: logging.getLogger('HWR').info('[QUEUE] is:\n%s ' % qutils.queue_to_json()) return Response(status=200)
def queue_update_item(sqid, tqid): data = request.get_json() model, entry = qutils.get_entry(tqid) sample_model, sample_entry = qutils.get_entry(sqid) if data["type"] == "DataCollection": qutils.set_dc_params(model, entry, data, sample_model) elif data["type"] == "Characterisation": qutils.set_char_params(model, entry, data, sample_model) logging.getLogger('HWR').info('[QUEUE] is:\n%s ' % qutils.queue_to_json()) resp = qutils.queue_to_json_response([model]) resp.status_code = 200 return resp
def queue_update_item(sid, tindex): data = request.get_json() current_queue = qutils.queue_to_dict() if tindex in ['undefined']: node_id = current_queue[sid]["queueID"] else: node_id = current_queue[sid]["tasks"][int(tindex)]["queueID"] model, entry = qutils.get_entry(node_id) if data["type"] == "DataCollection": qutils.set_dc_params(model, entry, data) elif data["type"] == "Characterisation": qutils.set_char_params(model, entry, data) logging.getLogger('HWR').info('[QUEUE] is:\n%s ' % qutils.queue_to_json()) return Response(status=200)
def queue_delete_item(): item_pos_list = request.get_json() current_queue = qutils.queue_to_dict() for (sid, tindex) in item_pos_list: if tindex in ['undefined', None]: node_id = current_queue[sid]["queueID"] model, entry = qutils.get_entry(node_id) else: node_id = current_queue[sid]["tasks"][int(tindex)]["queueID"] model, entry = qutils.get_entry(node_id) # Get the TaskGroup of the item, there is currently only one # task per TaskGroup so we have to remove the entire TaskGroup # with its task. entry = entry.get_container() qutils.delete_entry(entry) logging.getLogger('HWR').info('[QUEUE] is:\n%s ' % qutils.queue_to_json()) return Response(status=200)
def queue_set_sample_order(): sample_order = request.get_json().get("sampleOrder", []) qutils.set_sample_order(sample_order) limsutils.sample_list_set_order(sample_order) logging.getLogger('HWR').info('[QUEUE] is:\n%s ' % qutils.queue_to_json()) return Response(status=200)
def queue_move_task_item(sid, ti1, ti2): qutils.move_task_entry(sid, int(ti1), int(ti2)) logging.getLogger('HWR').info('[QUEUE] is:\n%s ' % qutils.queue_to_json()) return Response(status=200)
def queue_delete_item(): item_pos_list = request.get_json() qutils.delete_entry_at(item_pos_list) logging.getLogger('HWR').info('[QUEUE] is:\n%s ' % qutils.queue_to_json()) return Response(status=200)
def queue_add_item(): qutils.queue_add_item(request.get_json()) logging.getLogger('HWR').info('[QUEUE] is:\n%s ' % qutils.queue_to_json()) return Response(status=200)