Ejemplo n.º 1
0
def beamline_abort_action(name):
    """
    Aborts an action in progress.

    :param str name: Owner / Actuator of the process/action to abort

    Replies with status code 200 on success and 520 on exceptions.
    """
    try:
        cmds = mxcube.actions.getCommands()
    except Exception:
        cmds = []
    
    for cmd in cmds:
        if cmd.name() == name:
            try:
                cmd.abort()
            except Exception:
                err = sys.exc_info()[0]
                return make_response(err, 520) 
            else:
                return make_response("", 200)
   
    ho = BeamlineSetupMediator(mxcube.beamline).getObjectByRole(name.lower())

    try:
        ho.stop()
    except Exception:
        err = sys.exc_info()[0]
        return make_response(err, 520)
    else:
        logging.getLogger('user_level_log').error('Aborted by user.')
        return make_response("", 200)
Ejemplo n.º 2
0
def beamline_abort_action(name):
    """
    Aborts an action in progress.

    :param str name: Owner / Actuator of the process/action to abort
    """
    # This could be made to give access to arbitrary method of HO, possible
    # security issues to be discussed.
    ho = BeamlineSetupMediator(mxcube.beamline).getObjectByRole(name.lower())
    ho.stop()

    return Response('', status=200, mimetype='application/json')
Ejemplo n.º 3
0
def beamline_abort_action(name):
    """
    Aborts an action in progress.

    :param str name: Owner / Actuator of the process/action to abort
    """
    # This could be made to give access to arbitrary method of HO, possible
    # security issues to be discussed.
    ho = BeamlineSetupMediator(mxcube.beamline).getObjectByRole(name.lower())
    ho.stop()

    return Response('', status=200, mimetype='application/json')
Ejemplo n.º 4
0
def beamline_abort_action(name):
    """
    Aborts an action in progress.

    :param str name: Owner / Actuator of the process/action to abort

    Replies with status code 200 on success and 520 on exceptions.
    """
    try:
        cmds = mxcube.actions.getCommands()
    except Exception:
        cmds = []

    for cmd in cmds:
        if cmd.name() == name:
            try:
                cmd.abort()
            except Exception:
                err = str(sys.exc_info()[1])
                return make_response(err, 520)
            else:
                return make_response("", 200)

    # This could be made to give access to arbitrary method of HO, possible
    # security issues to be discussed.
    if name.lower() == "detdist":
        ho = BeamlineSetupMediator(mxcube.beamline).getObjectByRole("dtox")
    else:
        ho = BeamlineSetupMediator(mxcube.beamline).getObjectByRole(name.lower())
    ho.stop()

    try:
        ho.stop()
    except Exception:
        err = str(sys.exc_info()[1])
        return make_response(err, 520)
    else:
        logging.getLogger('user_level_log').error('Aborting set on %s.' % name)
        return make_response("", 200)