reporting.dasmon package
Subpackages
Submodules
reporting.dasmon.admin module
- class reporting.dasmon.admin.ActiveInstrumentAdmin(model, admin_site)[source]
Bases:
ModelAdmin- list_display = ('id', 'instrument_id', 'is_alive', 'is_adara')
- list_editable = ('is_alive', 'is_adara')
- property media
reporting.dasmon.models module
Dasmon app models @author: M. Doucet, Oak Ridge National Laboratory @copyright: 2015 Oak Ridge National Laboratory
- class reporting.dasmon.models.ActiveInstrument(*args, **kwargs)[source]
Bases:
ModelTable containing the list of instruments that are expecting to have their DAS turned ON
- exception DoesNotExist
Bases:
ObjectDoesNotExist
- exception MultipleObjectsReturned
Bases:
MultipleObjectsReturned
- has_pvsd
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- has_pvstreamer
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- id
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- instrument_id
Accessor to the related object on the forward side of a one-to-one relation.
In the example:
class Restaurant(Model): place = OneToOneField(Place, related_name='restaurant')
Restaurant.placeis aForwardOneToOneDescriptorinstance.
- instrument_id_id
- is_adara
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- is_alive
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- objects = <reporting.dasmon.models.ActiveInstrumentManager object>
- class reporting.dasmon.models.ActiveInstrumentManager(*args, **kwargs)[source]
Bases:
ManagerTable of options for instruments
- class reporting.dasmon.models.Parameter(*args, **kwargs)[source]
Bases:
ModelTable holding the names of the measured quantities
- exception DoesNotExist
Bases:
ObjectDoesNotExist
- exception MultipleObjectsReturned
Bases:
MultipleObjectsReturned
- id
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- monitored
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- name
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- objects = <django.db.models.manager.Manager object>
- statuscache_set
Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.childrenis aReverseManyToOneDescriptorinstance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()defined below.
- statusvariable_set
Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.childrenis aReverseManyToOneDescriptorinstance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()defined below.
- class reporting.dasmon.models.StatusCache(*args, **kwargs)[source]
Bases:
ModelTable of cached status variable values
- exception DoesNotExist
Bases:
ObjectDoesNotExist
- exception MultipleObjectsReturned
Bases:
MultipleObjectsReturned
- get_next_by_timestamp(*, field=<django.db.models.fields.DateTimeField: timestamp>, is_next=True, **kwargs)
- get_previous_by_timestamp(*, field=<django.db.models.fields.DateTimeField: timestamp>, is_next=False, **kwargs)
- id
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- instrument_id
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parentis aForwardManyToOneDescriptorinstance.
- instrument_id_id
- key_id
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parentis aForwardManyToOneDescriptorinstance.
- key_id_id
- objects = <django.db.models.manager.Manager object>
- timestamp
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- value
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- class reporting.dasmon.models.StatusVariable(*args, **kwargs)[source]
Bases:
ModelTable containing key-value pairs from the DASMON
- exception DoesNotExist
Bases:
ObjectDoesNotExist
- exception MultipleObjectsReturned
Bases:
MultipleObjectsReturned
- get_next_by_timestamp(*, field=<django.db.models.fields.DateTimeField: timestamp>, is_next=True, **kwargs)
- get_previous_by_timestamp(*, field=<django.db.models.fields.DateTimeField: timestamp>, is_next=False, **kwargs)
- id
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- instrument_id
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parentis aForwardManyToOneDescriptorinstance.
- instrument_id_id
- key_id
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parentis aForwardManyToOneDescriptorinstance.
- key_id_id
- objects = <django.db.models.manager.Manager object>
- timestamp
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- value
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
reporting.dasmon.urls module
Define url structure
reporting.dasmon.view_util module
Status monitor utilities to support ‘dasmon’ views
@author: M. Doucet, Oak Ridge National Laboratory @copyright: 2014 Oak Ridge National Laboratory
- reporting.dasmon.view_util.add_status_entry(instrument_id, message_channel, value)[source]
Add a status message for a given instrument.
- Parameters:
instrument_id – Instrument object
message_channel – name of the AMQ channel used to report updates
value – value for the entry (string)
- reporting.dasmon.view_util.dasmon_diagnostics(instrument_id, timeout=None)[source]
Diagnostics for DASMON
- Parameters:
instrument_id – Instrument object
timeout – number of seconds of silence before declaring a problem
- reporting.dasmon.view_util.fill_template_values(request, **template_args)[source]
Fill a template dictionary with information about the instrument
- reporting.dasmon.view_util.get_cached_variables(instrument_id, monitored_only=False)[source]
Get cached parameter values for a given instrument
- Parameters:
instrument_id – Instrument object
monitored_only – if True, only monitored parameters are returned
- reporting.dasmon.view_util.get_component_status(instrument_id, red_timeout=1, yellow_timeout=None, process='dasmon')[source]
Get the health status of an ADARA component
- Parameters:
red_timeout – number of hours before declaring a process dead
yellow_timeout – number of seconds before declaring a process slow
- reporting.dasmon.view_util.get_instrument_status_summary(expert=False) list[source]
Status for each instrument in the database, used to fill out the summary page template or the summary update response.
Returns
list: List of dictionaries, each representing the status of an instrument. Each dictionary has the following keys: - name: str, instrument name - recording_status: bool, True if the instrument is currently recording data - url: str, URL to access the instrument’s live monitor page - diagnostics_url: str, URL to access the instrument’s diagnostics page - dasmon_status: int, status of the DASMON process (0 = OK, 1 = Warning, 2 = Error) - pvstreamer_status: int, status of the PVStreamer process (0 = OK, 1 = Warning, 2 = Error) - facility: str, facility name (default = “SNS
- reporting.dasmon.view_util.get_instruments_for_user(request)[source]
Get the list of instruments for a given user
- reporting.dasmon.view_util.get_latest(instrument_id, key_id)[source]
Returns the latest entry for a given key on a given instrument
- Parameters:
instrument_id – Instrument object
key_id – Parameter object
- reporting.dasmon.view_util.get_latest_updates(instrument_id, message_channel, timeframe=2.0, number_of_entries=10, start_time=None)[source]
Return a list of recent status messages received on a given channel.
- Parameters:
instrument_id – Instrument object
message_channel – name of the AMQ channel used to report updates
timeframe – number of days to report on
number_of_entries – number of recent entries to return if nothing was found in the desired time frame
start_time – earliest time of returned entries. Takes precedence over timeframe and number.
- reporting.dasmon.view_util.get_live_variables(request, instrument_id)[source]
Create a data dictionary with requested live data
- Parameters:
request – HttpRequest object
instrument_id – Instrument object
- reporting.dasmon.view_util.get_monitor_breadcrumbs(instrument_id, current_view='monitor')[source]
Create breadcrumbs for a live monitoring view
- Parameters:
instrument_id – Instrument object
current_view – name to give this view
- reporting.dasmon.view_util.get_pvstreamer_status(instrument_id, red_timeout=1, yellow_timeout=None)[source]
Get the health status of PVStreamer
- Parameters:
red_timeout – number of hours before declaring a process dead
yellow_timeout – number of seconds before declaring a process slow
- reporting.dasmon.view_util.get_run_list_instrument_newest(instrument_id, offset, limit, run_search, date_search, status_search, title_search='')[source]
Get the latest runs for a given instrument
- reporting.dasmon.view_util.get_run_list_ipts(instrument_id, ipts_id, offset, limit, order_by, reverse_dir, run_search, date_search, status_search, title_search='')[source]
Get the list of runs for a given instrument and IPTS
- reporting.dasmon.view_util.get_run_list_newest(offset, limit, instrument_search, run_search, date_search, status_search, title_search='')[source]
Get the latest runs for all instruments
- reporting.dasmon.view_util.get_system_health(instrument_id=None)[source]
Get system health status. If an instrument_id is provided, the sub-systems relevant to that instrument will also be provided, otherwise only common sub-systems are provided.
- Parameters:
instrument_id – Instrument object
- reporting.dasmon.view_util.get_workflow_status(red_timeout=1, yellow_timeout=None)[source]
Get the health status of Workflow Manager
- Parameters:
red_timeout – number of hours before declaring a process dead
yellow_timeout – number of seconds before declaring a process slow
- reporting.dasmon.view_util.postprocessing_diagnostics(timeout=None)[source]
Diagnostics for the auto-reduction and cataloging
- Parameters:
timeout – number of seconds of silence before declaring a problem
- reporting.dasmon.view_util.pvstreamer_diagnostics(instrument_id, timeout=None, process='pvstreamer')[source]
Diagnostics for PVStreamer
- Parameters:
instrument_id – Instrument object
timeout – number of seconds of silence before declaring a problem
process – name of the process to diagnose (pvsd or pvstreamer)
reporting.dasmon.views module
Live monitoring