utils.views package#
Submodules#
utils.views.cobalt_batch module#
- class utils.views.cobalt_batch.CobaltBatch(name, schedule, instance=None, rerun=False)[source]#
Bases:
objectClass to handle batch jobs within Cobalt. We use cron (or whatever you like) to trigger the jobs which are set up using django-extensions.
- Parameters:
name (str)
schedule (str)
instance (str)
rerun (bool)
- Returns:
CobaltBatch
utils.views.cobalt_lock module#
utils.views.general module#
- utils.views.general.cobalt_report_ref_dates(request: HttpRequest = None)[source]#
Common function to handle dates
Accepts an optional HttpRequest which can contain POST data with a “ref_date” parameter ref_date should be dd/mm/yyyy
Used for when you want to get things like the first and last date of the previous month
Returns a dictionary of timezone aware dates, can be updated if anything is missing
ref_date: last day of previous month, or ref_date value from request ref_date_month_earlier: date a month earlier, same day of month
- utils.views.general.download_csv(self, request, queryset)[source]#
Copied from Stack Overflow - generic CSV download
- utils.views.general.masterpoint_query(query)[source]#
Generic function to talk to the masterpoints server and return data
Takes in a SQLServer query e.g. “select count(*) from table”
Returns an iterable, either an empty list or the response from the server.
In case there is a problem connecting to the server, this will do everything it can to fail silently.
utils.views.monitoring module#
- utils.views.monitoring.admin_show_aws_app_version_htmx(request)[source]#
Show the Elastic Beanstalk App details for a version
- utils.views.monitoring.admin_show_aws_infrastructure_info(request)[source]#
Show some AWS info to check on health of system
- utils.views.monitoring.admin_show_database_details_htmx(request)[source]#
Show the database info for an environment
- utils.views.monitoring.admin_system_activity_cobalt_messages_htmx(request)[source]#
Provide latest data from the cobalt messages log
- utils.views.monitoring.admin_system_activity_nginx_htmx(request)[source]#
Provide latest data from the nginx access.log
- utils.views.monitoring.admin_system_activity_users_htmx(request)[source]#
Provide latest data from user activity