mirror of
https://github.com/netzbegruenung/green-spider.git
synced 2024-04-28 15:24:51 +02:00
Marian Steinbach
618e29d763
* CLI: remove 'jobs' command, add 'manager' * Add job definition * Move jobs to manage folder * Rename jobs to manager * Add rq and redis dependencies * Add docker-compose YAML * Downgrade to alpine 3.8 * Adjust paths in Dockerfile, remove entrypoint * Rename 'make spiderjobs' to 'make jobs' * Fix docker exectution * Adapt 'make jobs' * Fix metadata scheme * Add docker dependency * Rendomize queue (a bit) * Use latest image, remove debug output * Make docker-compose file downwards-compatible * Use latest instead of dev image tag * Update docker-compose.yaml * Adapt job start script * Fix redis connection in manager * Add support for increasing timeout via environment variable * Adapt load_in_browser to cookies table schema change * Fix execution * Mitigate yaml warning * Bump some dependency versions * Report resource usage stats for each job * checks/load_in_browser: Return DOM size, prevent multiple page loads * Update .dockerignore * Code update * Script update * Update README.md * WIP * WIP commit * Update Dockerfile to alpine:edge and chromium v90 * Update TestCertificateChecker * Set defaults for __init__ function * Detect sunflower theme * Update unit test for new datetime (zero-basing) * Set logging prefs from Chromium in a new way * Move datastore client instantiation As it is not needed for all commands * Change green-directory repository URL * Add git settings for cloning green-directory * Pin alpine version 3.14, fix py3-cryptography * Use plain docker build progress output * Add volumes to 'make test' docker run command * Fix bug * Update example command in README * Update dependencies * Add creation of Kubernetes jobs
45 lines
1.2 KiB
Python
45 lines
1.2 KiB
Python
class AbstractChecker(object):
|
|
"""
|
|
Our blueprint for checks
|
|
"""
|
|
|
|
def __init__(self, config, previous_results=None):
|
|
self._config = config
|
|
|
|
# A dictionary of results from previous checkers.
|
|
# Key is the name of the checker that has generated the result.
|
|
self._previous_results = previous_results
|
|
|
|
def depends_on_results(self):
|
|
"""
|
|
Should return the name(s) of checks this one depends on.
|
|
Empty list means this check has no prerequisites.
|
|
"""
|
|
return []
|
|
|
|
def run(self):
|
|
"""Executes the check routine, returns result dict"""
|
|
raise NotImplementedError()
|
|
|
|
def post_hook(self, result):
|
|
"""
|
|
Optional function to execute after run(). Can be used to post-process
|
|
results data. Should be defined by the implementing checker.
|
|
|
|
Params:
|
|
result: Result data from the run() function.
|
|
|
|
Returns:
|
|
Dict: Modified results data
|
|
None: Means that nothing has been done, so should be ignored.
|
|
"""
|
|
return None
|
|
|
|
@property
|
|
def config(self):
|
|
return self._config
|
|
|
|
@property
|
|
def previous_results(self):
|
|
return self._previous_results
|