Exemplo n.º 1
0
def queue_execution_failed(entry):
    msg = {
        'Signal': qutils.queue_exec_state(),
        'Message': 'Queue execution stopped'
    }

    safe_emit('queue', msg, namespace='/hwr')
Exemplo n.º 2
0
def collect_oscillation_failed(owner,
                               status,
                               state,
                               lims_id,
                               osc_id,
                               params=None):
    if mxcube.rest_lims:
        limsres = mxcube.rest_lims.get_dc(node.id)
    else:
        logging.getLogger("HWR").warning(
            'No REST Lims interface has been defined.')
        limsres = ''

    msg = {
        'Signal': 'collectOscillationFailed',
        'Message': task_signals['collectOscillationFailed'],
        'taskIndex': last_queue_node()['idx'],
        'sample': last_queue_node()['sample'],
        'limstResultData': limsres,
        'state': get_signal_result('collectOscillationFailed'),
        'progress': 100
    }
    logging.getLogger('HWR').debug('[TASK CALLBACK]   ' + str(msg))
    try:
        safe_emit('task', msg, namespace='/hwr')
    except Exception:
        logging.getLogger("HWR").error('error sending message: ' + str(msg))
Exemplo n.º 3
0
def queue_execution_paused(state):
    if state:
        msg = {'Signal': 'QueuePaused', 'Message': 'Queue execution paused'}
    else:
        msg = {'Signal': 'QueueRunning', 'Message': 'Queue execution paused'}
    
    safe_emit('queue', msg, namespace='/hwr')
Exemplo n.º 4
0
def collect_oscillation_failed(owner=None, status=FAILED, state=None,
                               lims_id='', osc_id=None, params=None):
    node = last_queue_node()

    mxcube.NODE_ID_TO_LIMS_ID[node['queue_id']] = lims_id

    if not qutils.is_interleaved(node["node"]):
        try:
            limsres = mxcube.rest_lims.get_dc(lims_id)
        except:
            limsres = {}

        msg = {'Signal': 'collectOscillationFailed',
               'Message': task_signals['collectOscillationFailed'],
               'taskIndex': node['idx'],
               'queueID': node['queue_id'],
               'sample': node['sample'],
               'state': FAILED,
               'progress': 0}

        logging.getLogger('HWR').debug('[TASK CALLBACK] ' + str(msg))
        
        try:
            safe_emit('task', msg, namespace='/hwr')
        except Exception:
            logging.getLogger("HWR").error('error sending message: ' + str(msg))
Exemplo n.º 5
0
def queue_execution_finished(entry, queue_state=None):
    state = queue_state if queue_state else qutils.queue_exec_state()
    msg = {'Signal': state, 'Message': 'Queue execution stopped'}

    qutils.enable_sample_entries(mxcube.TEMP_DISABLED, True)
    mxcube.TEMP_DISABLED = []

    safe_emit('queue', msg, namespace='/hwr')
Exemplo n.º 6
0
def queue_execution_entry_finished(entry):
    handle_auto_mount_next(entry)

    if not qutils.is_interleaved(entry.get_data_model()):
        safe_emit('task', get_task_state(entry), namespace='/hwr')

    if isinstance(entry, qe.SampleQueueEntry):
        msg = {'Signal': 'DisableSample', 'sampleID': entry.get_data_model().loc_str}
        safe_emit('queue', msg, namespace='/hwr')
Exemplo n.º 7
0
def collect_oscillation_started(*args):
    msg = {'Signal': 'collectOscillationStarted',
           'Message': task_signals['collectOscillationStarted'],
           'taskIndex': last_queue_node()['idx'] ,
           'sample': last_queue_node()['sample'],
           'state': get_signal_result('collectOscillationStarted'),
           'progress': 0}

    logging.getLogger('HWR').debug('[TASK CALLBACK] ' + str(msg))
    try:
        safe_emit('task', msg, namespace='/hwr')
    except Exception:
        logging.getLogger("HWR").error('error sending message: ' + str(msg))
Exemplo n.º 8
0
def collect_oscillation_failed(owner, status, state, lims_id, osc_id, params):
    msg = {'Signal': 'collectOscillationFailed',
           'Message': task_signals['collectOscillationFailed'],
           'taskIndex' : last_queue_node()['idx'] ,
           'sample': last_queue_node()['sample'],
           'limstResultData': mxcube.rest_lims.get_dc(lims_id),
           'state': get_signal_result('collectOscillationFailed'),
           'progress': 100}
    logging.getLogger('HWR').debug('[TASK CALLBACK]   ' + str(msg))
    try:
        safe_emit('task', msg, namespace='/hwr')
    except Exception:
        logging.getLogger("HWR").error('error sending message: ' + str(msg))
Exemplo n.º 9
0
def collect_oscillation_started(*args):
    msg = {'Signal': 'collectOscillationStarted',
           'Message': task_signals['collectOscillationStarted'],
           'taskIndex': last_queue_node()['idx'] ,
           'sample': last_queue_node()['sample'],
           'state': get_signal_result('collectOscillationStarted'),
           'progress': 0}

    logging.getLogger('HWR').debug('[TASK CALLBACK] ' + str(msg))
    try:
        safe_emit('task', msg, namespace='/hwr')
    except Exception:
        logging.getLogger("HWR").error('error sending message: ' + str(msg))
Exemplo n.º 10
0
def collect_ended(owner, success, message):
    state = 2 if success else 3

    msg = {'Signal': 'collectOscillationFinished',
           'Message': message,
           'taskIndex': last_queue_node()['idx'] ,
           'sample': last_queue_node()['sample'],
           'state': state,
           'progress': 100}
    logging.getLogger('HWR').debug('[TASK CALLBACK] ' + str(msg))
    try:
        safe_emit('task', msg, namespace='/hwr')
    except Exception:
        logging.getLogger("HWR").error('error sending message: ' + str(msg))
Exemplo n.º 11
0
def collect_ended(owner, success, message):
    state = 2 if success else 3

    msg = {'Signal': 'collectOscillationFinished',
           'Message': message,
           'taskIndex': last_queue_node()['idx'] ,
           'sample': last_queue_node()['sample'],
           'state': state,
           'progress': 100}
    logging.getLogger('HWR').debug('[TASK CALLBACK] ' + str(msg))
    try:
        safe_emit('task', msg, namespace='/hwr')
    except Exception:
        logging.getLogger("HWR").error('error sending message: ' + str(msg))
Exemplo n.º 12
0
def collect_oscillation_finished(owner, status, state, lims_id, osc_id, params):
    qutils.enable_entry(last_queue_node()['queue_id'], False)
    
    msg = {'Signal': 'collectOscillationFinished',
           'Message': task_signals['collectOscillationFinished'],
           'taskIndex': last_queue_node()['idx'] ,
           'sample': last_queue_node()['sample'],
           'limsResultData': mxcube.rest_lims.get_dc(lims_id),
           'state': 2,
           'progress': 100}
    logging.getLogger('HWR').debug('[TASK CALLBACK] ' + str(msg))
    try:
        safe_emit('task', msg, namespace='/hwr')
    except Exception:
        logging.getLogger("HWR").error('error sending message: ' + str(msg))
Exemplo n.º 13
0
def xrf_task_progress(taskId, progress):
    node = last_queue_node()

    msg = {'Signal': 'XRFTaskUpdate',
           'Message': 'XRFTaskUpdate',
           'taskIndex': node['idx'],
           'queueID': node['queue_id'],
           'sample': node['sample'],
           'state': RUNNING if progress < 1 else COLLECTED,
           'progress': progress}

    try:
        safe_emit('task', msg, namespace='/hwr')
    except Exception:
        logging.getLogger("HWR").error('error sending message: ' + str(msg))
Exemplo n.º 14
0
def task_event_callback(*args, **kwargs):
    logging.getLogger('HWR').debug('[TASK CALLBACK]')
    logging.getLogger("HWR").debug(kwargs)
    logging.getLogger("HWR").debug(args)

    msg = {'Signal': kwargs['signal'],
           'Message': task_signals[kwargs['signal']],
           'taskIndex': last_queue_node()['idx'] ,
           'sample': last_queue_node()['sample'],
           'state': get_signal_result(kwargs['signal']),
           'progress': get_signal_progress(kwargs['signal'])}
    logging.getLogger('HWR').debug('[TASK CALLBACK] ' + str(msg))
    try:
        safe_emit('task', msg, namespace='/hwr')
    except Exception:
        logging.getLogger("HWR").error('error sending message: ' + str(msg))
Exemplo n.º 15
0
def task_event_callback(*args, **kwargs):
    logging.getLogger('HWR').debug('[TASK CALLBACK]')
    logging.getLogger("HWR").debug(kwargs)
    logging.getLogger("HWR").debug(args)

    msg = {'Signal': kwargs['signal'],
           'Message': task_signals[kwargs['signal']],
           'taskIndex': last_queue_node()['idx'] ,
           'sample': last_queue_node()['sample'],
           'state': get_signal_result(kwargs['signal']),
           'progress': get_signal_progress(kwargs['signal'])}
    logging.getLogger('HWR').debug('[TASK CALLBACK] ' + str(msg))
    try:
        safe_emit('task', msg, namespace='/hwr')
    except Exception:
        logging.getLogger("HWR").error('error sending message: ' + str(msg))
Exemplo n.º 16
0
def queue_interleaved_finished():
    node = last_queue_node()

    msg = {'Signal': "queue_interleaved_finished",
           'Message': "Interleaved collection ended",
           'taskIndex': node['idx'],
           'queueID': node['queue_id'],
           'sample': node['sample'],
           'state': COLLECTED,
           'progress': 1}

    logging.getLogger('HWR').debug('[TASK CALLBACK] ' + str(msg))

    try:
        safe_emit('task', msg, namespace='/hwr')
    except Exception:
        logging.getLogger("HWR").error('error sending message: ' + str(msg))
Exemplo n.º 17
0
def queue_interleaved_sw_done(data):
    node = last_queue_node()
    progress = qutils.get_task_progress(node["node"], data)

    msg = {'Signal': 'collectImageTaken',
           'Message': task_signals['collectImageTaken'],
           'taskIndex': node['idx'],
           'queueID': node['queue_id'],
           'sample': node['sample'],
           'state': RUNNING if progress < 1 else COLLECTED,
           'progress': progress}

    logging.getLogger('HWR').debug('[TASK CALLBACK] ' + str(msg))

    try:
        safe_emit('task', msg, namespace='/hwr')
    except Exception:
        logging.getLogger("HWR").error('error sending message: ' + str(msg))
Exemplo n.º 18
0
def collect_oscillation_started(*args):
    node = last_queue_node()

    if not qutils.is_interleaved(node["node"]):
        msg = {'Signal': 'collectOscillationStarted',
               'Message': task_signals['collectOscillationStarted'],
               'taskIndex': node['idx'],
               'queueID': node['queue_id'],
               'sample': node['sample'],
               'state': RUNNING,
               'progress': 0}

        logging.getLogger('HWR').debug('[TASK CALLBACK] ' + str(msg))

        try:
            safe_emit('task', msg, namespace='/hwr')
        except Exception:
            logging.getLogger("HWR").error('error sending message: ' + str(msg))
Exemplo n.º 19
0
def collect_ended(owner, success, message):
    node = last_queue_node()

    if not qutils.is_interleaved(node["node"]):
        state = COLLECTED if success else WARNING

        msg = {'Signal': 'collectOscillationFinished',
               'Message': message,
               'taskIndex': node['idx'],
               'queueID': node['queue_id'],
               'sample': node['sample'],
               'state': state,
               'progress': 1}

        logging.getLogger('HWR').debug('[TASK CALLBACK] ' + str(msg))

        try:
            safe_emit('task', msg, namespace='/hwr')
        except Exception:
            logging.getLogger("HWR").error('error sending message: ' + str(msg))
Exemplo n.º 20
0
def collect_oscillation_finished(owner, status, state, lims_id, osc_id, params):
    node = last_queue_node()
    mxcube.NODE_ID_TO_LIMS_ID[node['queue_id']] = lims_id

    if not qutils.is_interleaved(node["node"]):
        qutils.enable_entry(node['queue_id'], False)

        msg = {'Signal': 'collectOscillationFinished',
               'Message': task_signals['collectOscillationFinished'],
               'taskIndex': node['idx'],
               'queueID': node['queue_id'],
               'sample': node['sample'],
               'state': COLLECTED,
               'progress': 1}

        logging.getLogger('HWR').debug('[TASK CALLBACK] ' + str(msg))

        try:
            safe_emit('task', msg, namespace='/hwr')
        except Exception:
            logging.getLogger("HWR").error('error sending message: ' + str(msg))
Exemplo n.º 21
0
def queue_execution_started(entry, queue_state=None):
    state = queue_state if queue_state else qutils.queue_exec_state()
    msg = {'Signal': state, 'Message': 'Queue execution started'}

    safe_emit('queue', msg, namespace='/hwr')
Exemplo n.º 22
0
def queue_execution_failed(entry):
    msg = {'Signal': qutils.queue_exec_state(),
           'Message': 'Queue execution stopped'}

    safe_emit('queue', msg, namespace='/hwr')
Exemplo n.º 23
0
def queue_execution_finished(entry, queue_state=None):
    state = queue_state if queue_state else qutils.queue_exec_state()
    msg = {'Signal': state, 'Message': 'Queue execution stopped'}

    safe_emit('queue', msg, namespace='/hwr')
Exemplo n.º 24
0
def queue_execution_stopped(*args):
    msg = {'Signal': 'QueueStopped', 'Message': 'Queue execution stopped'}

    safe_emit('queue', msg, namespace='/hwr')