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))
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')
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')
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')
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))
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))
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))
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))
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))
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))
def queue_execution_failed(entry): msg = {'Signal': qutils.queue_exec_state(), 'Message': 'Queue execution stopped'} safe_emit('queue', msg, namespace='/hwr')
def queue_execution_stopped(*args): msg = {'Signal': 'QueueStopped', 'Message': 'Queue execution stopped'} safe_emit('queue', msg, namespace='/hwr')
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')