def get_update(request, instrument): """ Ajax call to get updates behind the scenes @param instrument: instrument name """ # Get instrument instrument_id = get_object_or_404(Instrument, name=instrument.lower()) # Get last experiment and last run data_dict = report.view_util.get_current_status(instrument_id) data_dict['variables'] = view_util.get_cached_variables(instrument_id, monitored_only=False) localtime = timezone.now() df = dateformat.DateFormat(localtime) recording_status = {"key": "recording_status", "value": view_util.is_running(instrument_id), "timestamp": df.format(settings.DATETIME_FORMAT), } data_dict['variables'].append(recording_status) # Get current DAS health status das_status = view_util.get_system_health(instrument_id) data_dict['das_status'] = das_status data_dict['live_plot_data'] = view_util.get_live_variables(request, instrument_id) # Recent run info data_dict = view_util.get_live_runs_update(request, instrument_id, None, **data_dict) response = HttpResponse(json.dumps(data_dict), content_type="application/json") response['Connection'] = 'close' response['Content-Length'] = len(response.content) return response
def run_summary_update(request): """ Ajax call to get updates behind the scenes """ # Recent run info data_dict = {} data_dict = view_util.get_live_runs_update(request, None, None, **data_dict) response = HttpResponse(json.dumps(data_dict), content_type="application/json") response['Connection'] = 'close' response['Content-Length'] = len(response.content) return response