Example #1
0
def init(hwr, hwdir):
    """
    Initializes the HardwareRepository with XML files read from hwdir.

    The hwr module must be imported at the very beginning of the application
    start-up to function correctly.

    This method can however be called later, so that initialization can be
    done when one wishes.

    :param hwr: HardwareRepository module
    :param str hwdir: Path to hardware objects

    :return: None
    """

    global HWR

    try:
        hwr.init_hardware_repository(path.abspath(path.expanduser(hwdir)))
        _hwr = hwr.getHardwareRepository()
        _hwr.connect()
        HWR = _hwr
    except Exception:
        logging.getLogger("HWR").exception("")
    try:
        global beamline, actions, plotting
        beamline = hwr.beamline

        qm = QueueManager.QueueManager("MXCuBE3")

        from mxcube3.core import qutils

        qutils.init_signals(hwr.beamline.queue_model)

    except Exception:
        msg = "Could not initialize one or several hardware objects, "
        msg += "stopped at first error ! \n"
        msg += "Make sure That all devices servers are running \n"
        msg += "Make sure that the detector software is running \n"
        exit_with_error(msg)
Example #2
0
import json
import logging
import signals

import queue_model_objects_v1 as qmo
import queue_entry as qe
import QueueManager

from flask import Response, jsonify, request, session
from mxcube3 import app as mxcube
from mxcube3 import socketio
from . import qutils

qm = QueueManager.QueueManager('Mxcube3')


@mxcube.route("/mxcube/api/v0.1/queue/start", methods=['PUT'])
def queue_start():
    """
    Start execution of the queue.

    :returns: Respons object, status code set to:
              200: On success
              409: Queue could not be started
    """
    logging.getLogger('HWR').info('[QUEUE] Queue going to start')

    try:
        mxcube.queue.queue_hwobj.set_pause(False)
        mxcube.queue.queue_hwobj.execute()
    except Exception as ex: