reporting.report package
Subpackages
- reporting.report.management package
Submodules
reporting.report.admin module
- class reporting.report.admin.DataRunAdmin(model, admin_site)[source]
Bases:
ModelAdmin
- list_display = ('id', 'run_number', 'instrument_id', 'ipts_id', 'file', 'created_on')
- list_filter = ('instrument_id', 'ipts_id')
- property media
- class reporting.report.admin.ErrorAdmin(model, admin_site)[source]
Bases:
ModelAdmin
- list_display = ('id', 'run_status_id', 'time', 'description')
- list_filter = ('run_status_id__run_id__instrument_id',)
- property media
- readonly_fields = ('run_status_id',)
- search_fields = ['description']
- class reporting.report.admin.IPTSAdmin(model, admin_site)[source]
Bases:
ModelAdmin
- list_display = ('expt_name', 'created_on', 'show_instruments')
- property media
- search_fields = ['instruments__name']
- class reporting.report.admin.InformationAdmin(model, admin_site)[source]
Bases:
ModelAdmin
- list_display = ('id', 'run_status_id', 'time', 'description')
- property media
- readonly_fields = ('run_status_id',)
- search_fields = ['description']
- class reporting.report.admin.InstrumentStatusAdmin(model, admin_site)[source]
Bases:
ModelAdmin
- list_display = ('id', 'instrument_id', 'last_run_id')
- property media
- readonly_fields = ('last_run_id',)
- class reporting.report.admin.RunStatusAdmin(model, admin_site)[source]
Bases:
ModelAdmin
- list_display = ('id', 'run_id', 'queue_id', 'created_on')
- list_filter = ('run_id__instrument_id', 'queue_id')
- property media
- readonly_fields = ('run_id',)
- search_fields = ['run_id__run_number']
- class reporting.report.admin.StatusQueueAdmin(model, admin_site)[source]
Bases:
ModelAdmin
- list_display = ('id', 'name', 'is_workflow_input')
- list_filter = ('is_workflow_input',)
- property media
- class reporting.report.admin.TaskAdmin(model, admin_site)[source]
Bases:
ModelAdmin
- list_display = ('id', 'instrument_id', 'input_queue_id', 'task_class', 'task_queues', 'success_queues')
- list_filter = ('instrument_id', 'input_queue_id')
- property media
- search_fields = ['instrument_id__name', 'input_queue_id__name']
- class reporting.report.admin.WorkflowSummaryAdmin(model, admin_site)[source]
Bases:
ModelAdmin
- actions = [<function reduction_not_needed>, <function reduction_needed>, <function reduction_complete>, <function reduction_incomplete>]
- list_display = ('run_id', 'date', 'complete', 'catalog_started', 'cataloged', 'reduction_needed', 'reduction_started', 'reduced', 'reduction_cataloged', 'reduction_catalog_started')
- list_editable = ('reduction_needed',)
- list_filter = ('run_id__instrument_id', 'complete', 'catalog_started', 'cataloged', 'reduction_needed', 'reduction_started', 'reduced', 'reduction_cataloged', 'reduction_catalog_started')
- property media
- readonly_fields = ('run_id',)
- search_fields = ['run_id__run_number']
reporting.report.catalog module
Optional utilities to communicate with ONcat. ONcat is an online data catalog used internally at ORNL.
@author: M. Doucet, Oak Ridge National Laboratory @copyright: 2018 Oak Ridge National Laboratory
- reporting.report.catalog.decode_time(timestamp)[source]
Decode timestamp and return a datetime object :param timestamp: timestamp to decode
- reporting.report.catalog.get_run_info(instrument, ipts, run_number)[source]
Legacy issue: Until the facility information is stored in the DB so that we can retrieve the facility from it, we’ll have to use the application configuration. :param str instrument: instrument short name :param str ipts: experiment name :param str run_number: run number :param str facility: facility name (SNS or HFIR)
reporting.report.detect_mobile module
reporting.report.forms module
Forms for auto-reduction configuration
@author: M. Doucet, Oak Ridge National Laboratory @copyright: 2016 Oak Ridge National Laboratory
- class reporting.report.forms.ProcessingForm(*args, **kwargs)[source]
Bases:
Form
Form to send a post-processing request
- base_fields = {'create_as_needed': <django.forms.fields.BooleanField object>, 'experiment': <django.forms.fields.CharField object>, 'instrument': <django.forms.fields.ChoiceField object>, 'run_list': <django.forms.fields.CharField object>, 'task': <django.forms.fields.ChoiceField object>}
- declared_fields = {'create_as_needed': <django.forms.fields.BooleanField object>, 'experiment': <django.forms.fields.CharField object>, 'instrument': <django.forms.fields.ChoiceField object>, 'run_list': <django.forms.fields.CharField object>, 'task': <django.forms.fields.ChoiceField object>}
- property media
Return all media required to render the widgets on this form.
reporting.report.models module
The definition of the models is shared by the workflow manager and the reporting app. The models are defined in the workflow manager and should be installed on the system before running the app.
reporting.report.urls module
Define url structure
reporting.report.view_util module
Status monitor utilities to support ‘report’ views
@author: M. Doucet, Oak Ridge National Laboratory @copyright: 2014 Oak Ridge National Laboratory
- reporting.report.view_util.append_key(input_url, instrument, run_id)[source]
Append a live data secret key to a url
- Parameters:
input_url – url to modify
instrument – instrument name
run_id – run number
- reporting.report.view_util.error_rate(instrument_id, n_hours=24)[source]
Returns the rate of errors for the last n_hours hours.
- Parameters:
instrument_id – Instrument model object
n_hours – number of hours to track
- reporting.report.view_util.extract_ascii_from_div(html_data, trace_id=None)[source]
Extract data from an plot <div>. Only returns the first one it finds.
- Parameters:
html_data – <div> string
#TODO: allow to specify which trace to return in cases where we have multiple curves
- reporting.report.view_util.extract_d3_data_from_json(json_data)[source]
DEPRECATED
For backward compatibility, extract D3 data from json data for the old-style interactive plots.
- Parameters:
json_data – json data block
- reporting.report.view_util.fill_template_values(request, **template_args)[source]
Fill the template argument items needed to populate side bars and other satellite items on the pages.
Only the arguments common to all pages will be filled.
- reporting.report.view_util.find_skipped_runs(instrument_id, start_run_number=0)[source]
Find run numbers that were skipped for a given instrument
- Parameters:
instrument_id – Instrument object
start_run_number – run number to start from
- reporting.report.view_util.generate_key(instrument: str, run_id: int)[source]
Generate a secret key for a run on a given instrument
- Parameters:
instrument – instrument name
run_id – run number
- reporting.report.view_util.get_current_status(instrument_id)[source]
Get current status information such as the last experiment/run for a given instrument.
Used to populate AJAX response, so must not contain Model objects
- Parameters:
instrument_id – Instrument model object
- reporting.report.view_util.get_plot_data_from_server(instrument, run_id, data_type='json')[source]
Get json data from the live data server
- Parameters:
instrument – instrument name
run_id – run number
data_type – data type, either ‘json’ or ‘html’
- reporting.report.view_util.get_plot_template_dict(run_object=None, instrument=None, run_id=None)[source]
Get template dictionary for plots
- Parameters:
run_object – DataRun object
instrument – instrument name
run_id – run_number
- reporting.report.view_util.get_post_processing_status(red_timeout=0.25, yellow_timeout=120)[source]
Get the health status of post-processing services :param red_timeout: number of hours before declaring a process dead :param yellow_timeout: number of seconds before declaring a process slow
- reporting.report.view_util.get_run_list_dict(run_list)[source]
Get a list of run object and transform it into a list of dictionaries that can be used to fill a table.
- Parameters:
run_list – list of run object (usually a QuerySet)
- reporting.report.view_util.get_run_status_text(run_id, show_error=False, use_element_id=False)[source]
Get a textual description of the current status for a given run
- Parameters:
run_id – run object
show_error – if true, the last error will be whow, otherwise “error”
- reporting.report.view_util.is_acquisition_complete(run_id)[source]
Determine whether the acquisition is complete and post-processing has started
- Parameters:
run_id – run object
- reporting.report.view_util.needs_reduction(request, run_id)[source]
Determine whether we need a reduction link to submit a run for automated reduction
- Parameters:
request – HTTP request object
run_id – DataRun object
- reporting.report.view_util.processing_request(request, instrument, run_id, destination)[source]
Process a request for post-processing
- Parameters:
instrument – instrument name
run_id – run number [string]
destination – outgoing AMQ queue
- reporting.report.view_util.retrieve_rates(instrument_id, last_run_id)[source]
Retrieve the run rate and error rate for an instrument. Try to get it from the cache if possible.
- Parameters:
instrument_id – Instrument object
last_run_id – DataRun object
reporting.report.views module
Report views
@author: M. Doucet, Oak Ridge National Laboratory @copyright: 2014-2015 Oak Ridge National Laboratory
- reporting.report.views.download_reduced_data(request, instrument, run_id)[source]
Download reduced data from live data server
- Parameters:
request – http request object
instrument – instrument name
run_id – run number
- reporting.report.views.processing_admin(request)[source]
Form to let admins easily reprocess parts of the workflow
- reporting.report.views.submit_for_cataloging(request, instrument, run_id)[source]
Send a run for cataloging
- Parameters:
instrument – instrument name
run_id – run number