9.1.2.10. GeoHealthCheck.models
9.1.2.10.1. Module Contents
9.1.2.10.1.1. Classes
measurement of resource state |
|
Identifies and parameterizes single Probe class. Probe |
|
Identifies and parameterizes check function, applies to single Probe |
|
Notification recipient |
|
m2m for Recipient <-> Resource |
|
HTTP accessible resource |
|
lock resource for multiprocessing runs |
|
user accounts. |
9.1.2.10.1.2. Functions
|
|
|
|
return frequency counts and totals of registered resource types |
|
return number of rows for Resource |
|
return number of rows for Run |
|
|
return number of rows for Run with given run status |
return last Run |
|
return last Run |
|
return last N Runs with results for each Resource |
|
return counts of all tags |
|
|
|
9.1.2.10.1.3. Attributes
- GeoHealthCheck.models.APP
- GeoHealthCheck.models.DB
- GeoHealthCheck.models.LOGGER
- GeoHealthCheck.models.flush_runs()
- class GeoHealthCheck.models.Run(resource, result, checked_datetime=datetime.utcnow())
Bases:
DB
measurement of resource state
- property report
- identifier
- resource_identifier
- resource
- checked_datetime
- success
- response_time
- message
- report
- _report
- __lt__(other)
- __le__(other)
- __eq__(other)
- __gt__(other)
- __ge__(other)
- __hash__()
- __repr__()
- for_json()
- class GeoHealthCheck.models.ProbeVars(resource_obj, probe_class, parameters={})
Bases:
DB
Identifies and parameterizes single Probe class. Probe instance applies to single parent Resource.
- property parameters
- property probe_instance
- property name
- property probe_parameters
- identifier
- resource_identifier
- resource
- probe_class
- _parameters
- __repr__()
- class GeoHealthCheck.models.CheckVars(probe_vars, check_class, parameters={})
Bases:
DB
Identifies and parameterizes check function, applies to single Probe
- property parameters
- identifier
- probe_vars_identifier
- probe_vars
- check_class
- _parameters
- __repr__()
- GeoHealthCheck.models.resource_tags
- GeoHealthCheck.models._validate_webhook(value)
- GeoHealthCheck.models._validate_email(value)
- class GeoHealthCheck.models.Recipient(channel, location)
Bases:
DB
Notification recipient
- TYPE_EMAIL = 'email'
- TYPE_WEBHOOK = 'webhook'
- TYPES = ()
- __tablename__ = 'recipient'
- VALIDATORS
- id
- channel
- location
- resources
- classmethod validate(channel, value)
Validate if provided value is correct for given channel
- is_email()
- is_webhook()
- classmethod burry_dead()
- classmethod get_or_create(channel, location)
- classmethod get_suggestions(channel, for_user)
Return list of values to autocomplete for specific user and channel.
- class GeoHealthCheck.models.ResourceNotification
Bases:
DB
m2m for Recipient <-> Resource
- __tablename__ = 'resourcenotification'
- resource_id
- recipient_id
- resource
- recipient
- class GeoHealthCheck.models.Resource(owner, resource_type, title, url, tags, auth=None)
Bases:
DB
HTTP accessible resource
- property run_count
- property get_capabilities_url
- property all_response_times
- property first_run
- property last_run
- property average_response_time
- property min_response_time
- property max_response_time
- property reliability
- property tags2csv
- property auth
- property auth_type
- identifier
- resource_type
- active
- title
- url
- latitude
- longitude
- owner_identifier
- owner
- tags
- run_frequency
- _auth
- __repr__()
- snippet()
- runs_to_json()
- success_to_colors()
- clear_recipients(channel=None, burry_dead=True)
- get_recipients(channel)
- set_recipients(channel, items)
- dump_recipients()
Return dictionary with channel ->recipients mapping
- has_auth()
- add_auth_header(headers_dict)
- for_json()
- class GeoHealthCheck.models.ResourceLock(resource, owner, interval_mins)
Bases:
DB
lock resource for multiprocessing runs
- identifier
- resource_identifier
- resource
- owner
- start_time
- end_time
- init_datetimes(interval_mins)
- has_expired()
- obtain(owner, frequency)
- __repr__()
- class GeoHealthCheck.models.User(username, password, email, role='user')
Bases:
DB
user accounts. Token handling thanks to: https://navaspot.wordpress.com/2014/06/25/ how-to-implement-forgot-password-feature-in-flask/
- identifier
- username
- password
- email
- role
- registered_on
- authenticate(password)
- encrypt(string)
- get_token(expiration=7200)
- is_authenticated()
- is_active()
- is_anonymous()
- get_id()
- set_password(password)
- static verify_token(token)
- __repr__()
- GeoHealthCheck.models.get_resource_types_counts()
return frequency counts and totals of registered resource types
- GeoHealthCheck.models.get_resources_count()
return number of rows for Resource
- GeoHealthCheck.models.get_runs_count()
return number of rows for Run
- GeoHealthCheck.models.get_runs_status_count(success=True)
return number of rows for Run with given run status
- GeoHealthCheck.models.get_first_run()
return last Run
- GeoHealthCheck.models.get_last_run()
return last Run
- GeoHealthCheck.models.get_last_run_per_resource()
return last N Runs with results for each Resource
- GeoHealthCheck.models.get_tag_counts()
return counts of all tags
- GeoHealthCheck.models.load_data(file_path)
- GeoHealthCheck.models.db_commit()
- GeoHealthCheck.models.APP