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
class reporting.dasmon.admin.LegacyURLAdmin(model, admin_site)[source]

Bases: ModelAdmin

list_display = ('id', 'instrument_id', 'url', 'long_name')
property media
class reporting.dasmon.admin.ParameterAdmin(model, admin_site)[source]

Bases: ModelAdmin

list_display = ('id', 'name', 'monitored')
list_editable = ('monitored',)
property media
class reporting.dasmon.admin.SignalAdmin(model, admin_site)[source]

Bases: ModelAdmin

list_display = ('id', 'instrument_id', 'name', 'message', 'level', 'timestamp')
property media
class reporting.dasmon.admin.StatusVariableAdmin(model, admin_site)[source]

Bases: ModelAdmin

list_display = ('id', 'instrument_id', 'key_id', 'value', 'timestamp', 'msg_time')
list_filter = ('instrument_id', 'key_id')
property media
msg_time(obj)[source]
class reporting.dasmon.admin.UserNotificationAdmin(model, admin_site)[source]

Bases: ModelAdmin

list_display = ('id', 'user_id', 'email')
property media

reporting.dasmon.legacy_status module

Get the status of legacy instruments

@author: M. Doucet, Oak Ridge National Laboratory @copyright: 2015 Oak Ridge National Laboratory

reporting.dasmon.legacy_status.get_legacy_url(instrument_id, include_domain=True)[source]

Generate URL for legacy instrument status data

Parameters:
  • instrument_id – Instrument object

  • include_domain – True if we need to return a complete URL

reporting.dasmon.legacy_status.get_ops_status(instrument_id)[source]

Pull the legacy status information

Parameters:

instrument_id – Instrument object

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: Model

Table 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 many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

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: Manager

Table of options for instruments

has_pvsd(instrument_id)[source]

Returns True if the instrument is running pvsd Defaults to False

has_pvstreamer(instrument_id)[source]

Returns True if the instrument is running PVStreamer Defaults to True

is_adara(instrument_id)[source]

Returns True if the instrument is running ADARA

is_alive(instrument_id)[source]

Returns True if the instrument should be presented as part of the suite of instruments

class reporting.dasmon.models.LegacyURL(*args, **kwargs)[source]

Bases: Model

Table of URLs pointing to the legacy instrument status service

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.

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.parent is a ForwardManyToOneDescriptor instance.

instrument_id_id
long_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>
url

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.Parameter(*args, **kwargs)[source]

Bases: Model

Table 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.children is a ReverseManyToOneDescriptor instance.

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.children is a ReverseManyToOneDescriptor instance.

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.Signal(*args, **kwargs)[source]

Bases: Model

Table of signals received from 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.parent is a ForwardManyToOneDescriptor instance.

instrument_id_id
level

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

message

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>
source

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

timestamp

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.StatusCache(*args, **kwargs)[source]

Bases: Model

Table 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.parent is a ForwardManyToOneDescriptor instance.

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.parent is a ForwardManyToOneDescriptor instance.

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: Model

Table 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.parent is a ForwardManyToOneDescriptor instance.

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.parent is a ForwardManyToOneDescriptor instance.

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.UserNotification(*args, **kwargs)[source]

Bases: Model

Table of users to notify

exception DoesNotExist

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: MultipleObjectsReturned

email

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.

instruments

Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.

In the example:

class Pizza(Model):
    toppings = ManyToManyField(Topping, related_name='pizzas')

Pizza.toppings and Topping.pizzas are ManyToManyDescriptor instances.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

objects = <django.db.models.manager.Manager object>
registered

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

user_id

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

class reporting.dasmon.view_util.SignalEntry(name='', status='', assert_time='', key='', ack_url='')[source]

Bases: object

Utility class representing a DASMON signal

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_completeness_status(instrument_id)[source]

Check that the latest runs have successfully completed post-processing

Parameters:

instrument_id – Instrument object

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_dashboard_data()[source]

Get all the run and error rates

reporting.dasmon.view_util.get_instrument_status_summary()[source]

Create an instrument status dictionary that can be used to fill out the summary page template or the summary update response.

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_runs(timeframe=12, number_of_entries=25, instrument_id=None, as_html=True)[source]

Get recent runs for all instruments. If no run is found in the last few hours (defined by the timeframe parameter), we return the last few runs (defined by the number_of_entries parameter).

Parameters:
  • timeframe – number of hours going back from now, defining the period of time for the runs

  • number_of_entries – number of entries to return if we didn’t find any run in the defined period

  • instrument_id – if provided, results will be limited to the given instrument

reporting.dasmon.view_util.get_live_runs_update(request, instrument_id, ipts_id, **data_dict)[source]

Get updated information about the latest runs

Parameters:
  • request – HTTP request so we can get the ‘since’ parameter

  • instrument_id – Instrument model object

  • ipts_id – filter by experiment, if provided

  • data_dict – dictionary to populate

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(run_list)[source]

Get a list of run object and transform it into a list of dictionaries that can be used as a simple dictionary that can be shipped as json.

Parameters:

run_list – list of run object (usually a QuerySet)

reporting.dasmon.view_util.get_signals(instrument_id)[source]

Get the current list of signals/alarms for a given instrument

Parameters:

instrument_id – Instrument object

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.is_running(instrument_id)[source]
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.view_util.workflow_diagnostics(timeout=None)[source]

Diagnostics for the workflow manager

Parameters:

timeout – number of seconds of silence before declaring a problem

reporting.dasmon.views module

Live monitoring

reporting.dasmon.views.notifications(request)[source]

Let an instrument team member register for a DASMON signal

Module contents