# resultsdbpy
Large projects (like [WebKit](https://webkit.org)) often have 10's of thousands of tests running on dozens of platforms. Making sense of results from theses tests is difficult. resultsdbpy aims to make visualizing, processing and storing those results easier.
## Requirements
For local testing and basic prototyping, nothing is required. All data can be managed in-memory. Note, however, that running the database in this mode will not save results to disk.
If leveraging Docker, Redis and Cassandra will be automatically installed and can be used to make results more persistent.
For production instances, the Cassandra and Redis instances should be hosted seperatly from the web-app.
## Usage
resultsdbpy requires fairly extensive configuration before being used. Below is an example of configuring resultsdbpy for testing and basic prototyping for Webkit, along with some comments explaining the environment setup:
```
import os
from fakeredis import FakeStrictRedis
from flask import Flask, request
from resultsdbpy.controller.api_routes import APIRoutes
from resultsdbpy.model.mock_cassandra_context import MockCassandraContext
from resultsdbpy.model.model import Model
from resultsdbpy.model.repository import WebKitRepository
from resultsdbpy.view.view_routes import ViewRoutes
# By default, Cassandra forbids schema management
os.environ['CQLENG_ALLOW_SCHEMA_MANAGEMENT'] = '1'
# An in-memory Cassandra database for testing
cassandra=MockCassandraContext(
nodes=['localhost'],
keyspace='testing-kespace',
create_keyspace=True,
)
model = Model(
redis=FakeStrictRedis(), # An in-memory Redis database for testing
cassandra=cassandra,
repositories=[WebKitRepository()], # This should be replaced with a class for your project's repository
default_ttl_seconds=Model.TTL_WEEK * 4, # Retain 4 weeks of results
async_processing=False, # Processing asynchronously requires instantiating worker processes
)
app = Flask(__name__)
api_routes = APIRoutes(model=model, import_name=__name__)
view_routes = ViewRoutes(
title='WebKit Results Database',
model=model, controller=api_routes, import_name=__name__,
)
@app.route('/__health', methods=('GET',))
def health():
return 'ok'
@app.errorhandler(404)
@app.errorhandler(405)
def handle_errors(error):
if request.path.startswith('/api/'):
return api_routes.error_response(error)
return view_routes.error(error=error)
app.register_blueprint(api_routes)
app.register_blueprint(view_routes)
def main():
app.run(host='0.0.0.0', port=5000)
if __name__ == '__main__':
main()
```
Raw data
{
"_id": null,
"home_page": "https://github.com/WebKit/WebKit/tree/main/Tools/Scripts/libraries/resultsdbpy",
"name": "resultsdbpy",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": "database history results testing webkit",
"author": "Jonathan Bedard",
"author_email": "jbedard@apple.com",
"download_url": "https://files.pythonhosted.org/packages/1c/5d/f3e84cc17a113666c431ce7ba4c8f34c64ff65fb9f963375889c990237f3/resultsdbpy-3.1.9.tar.gz",
"platform": null,
"description": "# resultsdbpy\n\nLarge projects (like [WebKit](https://webkit.org)) often have 10's of thousands of tests running on dozens of platforms. Making sense of results from theses tests is difficult. resultsdbpy aims to make visualizing, processing and storing those results easier.\n\n## Requirements\n\nFor local testing and basic prototyping, nothing is required. All data can be managed in-memory. Note, however, that running the database in this mode will not save results to disk.\n\nIf leveraging Docker, Redis and Cassandra will be automatically installed and can be used to make results more persistent.\n\nFor production instances, the Cassandra and Redis instances should be hosted seperatly from the web-app.\n\n\n## Usage\n\nresultsdbpy requires fairly extensive configuration before being used. Below is an example of configuring resultsdbpy for testing and basic prototyping for Webkit, along with some comments explaining the environment setup:\n\n```\nimport os\n\nfrom fakeredis import FakeStrictRedis\nfrom flask import Flask, request\nfrom resultsdbpy.controller.api_routes import APIRoutes\nfrom resultsdbpy.model.mock_cassandra_context import MockCassandraContext\nfrom resultsdbpy.model.model import Model\nfrom resultsdbpy.model.repository import WebKitRepository\nfrom resultsdbpy.view.view_routes import ViewRoutes\n\n# By default, Cassandra forbids schema management\nos.environ['CQLENG_ALLOW_SCHEMA_MANAGEMENT'] = '1'\n\n# An in-memory Cassandra database for testing\ncassandra=MockCassandraContext(\n\tnodes=['localhost'],\n\tkeyspace='testing-kespace',\n\tcreate_keyspace=True,\n)\n\nmodel = Model(\n\tredis=FakeStrictRedis(), # An in-memory Redis database for testing\n\tcassandra=cassandra,\n\trepositories=[WebKitRepository()], # This should be replaced with a class for your project's repository\n\tdefault_ttl_seconds=Model.TTL_WEEK * 4, # Retain 4 weeks of results\n\tasync_processing=False, # Processing asynchronously requires instantiating worker processes\n)\n\napp = Flask(__name__)\napi_routes = APIRoutes(model=model, import_name=__name__)\nview_routes = ViewRoutes(\n title='WebKit Results Database',\n model=model, controller=api_routes, import_name=__name__,\n)\n\n\n@app.route('/__health', methods=('GET',))\ndef health():\n return 'ok'\n\n\n@app.errorhandler(404)\n@app.errorhandler(405)\ndef handle_errors(error):\n if request.path.startswith('/api/'):\n return api_routes.error_response(error)\n return view_routes.error(error=error)\n\n\napp.register_blueprint(api_routes)\napp.register_blueprint(view_routes)\n\n\ndef main():\n app.run(host='0.0.0.0', port=5000)\n\n\nif __name__ == '__main__':\n main()\n\n```\n",
"bugtrack_url": null,
"license": "Modified BSD",
"summary": "Library for visualizing, processing and storing test results.",
"version": "3.1.9",
"project_urls": {
"Homepage": "https://github.com/WebKit/WebKit/tree/main/Tools/Scripts/libraries/resultsdbpy"
},
"split_keywords": [
"database",
"history",
"results",
"testing",
"webkit"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "9d4a8a3bdf83bd8c43f40275bfef5a339e4a974896e5f4e3aaf83ed80a9daa96",
"md5": "76673453c318a2323ea901d7d62323b4",
"sha256": "5d65b4dfecd2425dabc1a5a17971113d44ac1efaf2c5bf8a29cf5e6e56b580fc"
},
"downloads": -1,
"filename": "resultsdbpy-3.1.9-py3-none-any.whl",
"has_sig": false,
"md5_digest": "76673453c318a2323ea901d7d62323b4",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 301169,
"upload_time": "2024-10-18T18:15:01",
"upload_time_iso_8601": "2024-10-18T18:15:01.447800Z",
"url": "https://files.pythonhosted.org/packages/9d/4a/8a3bdf83bd8c43f40275bfef5a339e4a974896e5f4e3aaf83ed80a9daa96/resultsdbpy-3.1.9-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "1c5df3e84cc17a113666c431ce7ba4c8f34c64ff65fb9f963375889c990237f3",
"md5": "71927865e793e4b3013a52e9b325a756",
"sha256": "55ef04bb9b9635bd8801f675b4f3ca9d572897ca980d11284df34ef00ce03566"
},
"downloads": -1,
"filename": "resultsdbpy-3.1.9.tar.gz",
"has_sig": false,
"md5_digest": "71927865e793e4b3013a52e9b325a756",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 186401,
"upload_time": "2024-10-18T18:15:03",
"upload_time_iso_8601": "2024-10-18T18:15:03.519933Z",
"url": "https://files.pythonhosted.org/packages/1c/5d/f3e84cc17a113666c431ce7ba4c8f34c64ff65fb9f963375889c990237f3/resultsdbpy-3.1.9.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-10-18 18:15:03",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "WebKit",
"github_project": "WebKit",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "resultsdbpy"
}