Ejemplo n.º 1
0
def get_task_state(entry):
    node_id = entry.get_data_model()._node_id
    _, state = qutils.get_node_state(node_id)
    node_index = qutils.node_index(entry.get_data_model())
    lims_id = mxcube.NODE_ID_TO_LIMS_ID.get(node_id, "null")

    try:
        limsres = blcontrol.beamline.lims_rest.get_dc(lims_id)
    except BaseException:
        limsres = {}

    try:
        limsres["limsTaskLink"] = limsutils.get_dc_link(lims_id)
    except Exception:
        limsres["limsTaskLink"] = "#"
        msg = "Could not get lims link for collection with id: %s" % lims_id
        logging.getLogger("HWR").error(msg)

    msg = {
        "Signal": "",
        "Message": "",
        "taskIndex": node_index["idx"],
        "queueID": node_id,
        "sample": node_index["sample"],
        "limsResultData": limsres,
        "state": state,
        "progress": 1,
    }

    return msg
Ejemplo n.º 2
0
def get_task_state(entry):
    node_id = entry.get_data_model()._node_id
    _, state = qutils.get_node_state(node_id)
    node_index = qutils.node_index(entry.get_data_model())
    lims_id = mxcube.NODE_ID_TO_LIMS_ID.get(node_id, "null")

    try:
        limsres = blcontrol.rest_lims.get_dc(lims_id)
    except BaseException:
        limsres = {}

    try:
        limsres["limsTaskLink"] = limsutils.get_dc_link(lims_id)
    except Exception:
        limsres["limsTaskLink"] = "#"
        msg = "Could not get lims link for collection with id: %s" % lims_id
        logging.getLogger("HWR").error(msg)

    msg = {
        "Signal": "",
        "Message": "",
        "taskIndex": node_index["idx"],
        "queueID": node_id,
        "sample": node_index["sample"],
        "limsResultData": limsres,
        "state": state,
        "progress": 1,
    }

    return msg
Ejemplo n.º 3
0
def last_queue_node():
    node = blcontrol.beamline.queue_manager._current_queue_entries[-1].get_data_model()

    # Reference collections are orphans, the node we want is the
    # characterisation not the reference collection itself
    if "refdc" in node.get_name():
        parent = node.get_parent()
        node = parent._children[0]

    res = qutils.node_index(node)
    res["node"] = node

    return res
Ejemplo n.º 4
0
def last_queue_node():
    node = blcontrol.queue.queue_hwobj._current_queue_entries[-1].get_data_model()

    # Reference collections are orphans, the node we want is the
    # characterisation not the reference collection itself
    if "refdc" in node.get_name():
        parent = node.get_parent()
        node = parent._children[0]

    res = qutils.node_index(node)
    res["node"] = node

    return res
Ejemplo n.º 5
0
def update_task_result(entry):
    node_index = qutils.node_index(entry.get_data_model())
    node_id = entry.get_data_model()._node_id
    lims_id = mxcube.NODE_ID_TO_LIMS_ID.get(node_id, "null")

    try:
        limsres = blcontrol.beamline.lims_rest.get_dc(lims_id)
    except BaseException:
        limsres = {}

    try:
        limsres["limsTaskLink"] = limsutils.get_dc_link(lims_id)
    except Exception:
        limsres["limsTaskLink"] = "#"
        msg = "Could not get lims link for collection with id: %s" % lims_id
        logging.getLogger("HWR").error(msg)

    msg = {
        "sample": node_index["sample"],
        "taskIndex": node_index["idx"],
        "limsResultData": limsres,
    }

    socketio.emit("update_task_lims_data", msg, namespace="/hwr")
Ejemplo n.º 6
0
def update_task_result(entry):
    node_index = qutils.node_index(entry.get_data_model())
    node_id = entry.get_data_model()._node_id
    lims_id = mxcube.NODE_ID_TO_LIMS_ID.get(node_id, "null")

    try:
        limsres = blcontrol.rest_lims.get_dc(lims_id)
    except BaseException:
        limsres = {}

    try:
        limsres["limsTaskLink"] = limsutils.get_dc_link(lims_id)
    except Exception:
        limsres["limsTaskLink"] = "#"
        msg = "Could not get lims link for collection with id: %s" % lims_id
        logging.getLogger("HWR").error(msg)

    msg = {
        "sample": node_index["sample"],
        "taskIndex": node_index["idx"],
        "limsResultData": limsres,
    }

    socketio.emit("update_task_lims_data", msg, namespace="/hwr")