Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merges BD V3.3 changes: Upgrading BuildingDepot to Python3 #115

Merged
merged 117 commits into from
Feb 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
117 commits
Select commit Hold shift + click to select a range
182b29f
Update to Python3
shreyasnagare Jun 2, 2020
87b28bf
Fix flask app imports
shreyasnagare Jun 2, 2020
c768889
Fix xmlrpc imports
shreyasnagare Jun 2, 2020
0868fee
More flask app import fixes
shreyasnagare Jun 2, 2020
4c7206c
Fix jinja2 templates
shreyasnagare Jun 2, 2020
995f992
Update copyrights
shreyasnagare Jun 2, 2020
87a8c0f
Fix flask_wtf deprecation errors
shreyasnagare Jun 2, 2020
5e47e2d
Fix CentralReplica
shreyasnagare Jun 2, 2020
095f5f0
Fix OAuth errors - update redis params
shreyasnagare Jun 2, 2020
2d0ef5a
Update install scripts
shreyasnagare Jun 2, 2020
6ea0859
Update install scripts
shreyasnagare Jun 2, 2020
0ce5eeb
Update dependencies, she-bangs
shreyasnagare Jun 3, 2020
29af425
Fix authorization errors
shreyasnagare Jun 3, 2020
eb1c9eb
Fix invalidation and Redis DataErrors
shreyasnagare Jun 3, 2020
e12e14a
Fix RabbitMQ broker and queue issues
shreyasnagare Jun 3, 2020
1c7fed4
Fix RPC invalidation for sg permissions
shreyasnagare Jun 3, 2020
17be4af
Update dependencies list
shreyasnagare Jun 3, 2020
6407081
Update README.md, docs
shreyasnagare Jun 3, 2020
6038323
Update GitHub Actions workflow
shreyasnagare Jun 3, 2020
f6903fe
Merge remote-tracking branch 'origin/develop' into port-to-python3
shreyasnagare Sep 4, 2020
6e8d16a
Add v3.3 to GitHub actions
shreyasnagare Sep 4, 2020
a002c69
Update to Python 3
shreyasnagare Sep 4, 2020
377ed27
Fix CentralReplica imports
Sep 4, 2020
7c79c05
Update test_bd.yml
shreyasnagare Sep 4, 2020
ced7cc6
Update test_bd.yml
shreyasnagare Sep 11, 2020
e3dbf7c
Update test_bd.yml
shreyasnagare Sep 11, 2020
137d86a
Update test_bd.yml
shreyasnagare Sep 11, 2020
4892ad5
Merge remote-tracking branch 'origin/fix-build-issues' into v3.3
shreyasnagare Dec 22, 2020
6c2d4a7
Update to Python3
shreyasnagare Dec 22, 2020
024b369
Update python version matrix
shreyasnagare Dec 22, 2020
5ba4927
Reformat code and optimize imports
shreyasnagare Dec 22, 2020
32a3209
Update Mocha timeout
shreyasnagare Dec 22, 2020
268576b
Test on Ubuntu 20.04
shreyasnagare Jan 8, 2021
f3d4463
Revert tests to Ubuntu 18.04
shreyasnagare Jan 8, 2021
5841878
Update test_bd.yml workflow
shreyasnagare Apr 9, 2021
3497e67
Remove unsupported Python versions
shreyasnagare Apr 9, 2021
d389853
Remove arch x64
shreyasnagare Apr 9, 2021
ea290e7
Fix typo
shreyasnagare Apr 9, 2021
7f18f7c
Add continue-on-error
shreyasnagare Apr 9, 2021
e662e54
Disable fast-fail
shreyasnagare Apr 9, 2021
0c8f7ca
Fix workflow
shreyasnagare Apr 9, 2021
7ff470c
Merge remote-tracking branch 'origin/batch-requests' into python3
shreyasnagare Jun 4, 2021
67ba5d2
Merge Updates to DataService APIs to have batch inputs #110
shreyasnagare Jun 4, 2021
3de6ad1
Update copyright year
shreyasnagare Jun 4, 2021
b4d4c42
Add Python3 safety type casts
shreyasnagare Jun 4, 2021
f5659c8
Fix circular imports
shreyasnagare Jun 9, 2021
2f4631c
Fix pika queue declarations
shreyasnagare Jun 9, 2021
e532b02
Use shell context errors
shreyasnagare Jun 9, 2021
dd04c2c
Update dependency version
shreyasnagare Jun 9, 2021
ed2ba3b
Remove unused imports
shreyasnagare Jun 9, 2021
0851e6c
Add lts keys for node
shreyasnagare Jun 9, 2021
82695b7
bug fixes for rabbitmq build issues
sud335 Jun 11, 2021
20ae3fc
bug fixes for rabbitmq build issues
sud335 Jun 11, 2021
8249980
upgrades mongodb versions
sud335 Jun 11, 2021
88c6106
bug fixes for rabbitmq build issues
sud335 Jun 11, 2021
121d8bc
bug fixes for rabbitmq build issues
sud335 Jun 11, 2021
98734d0
Merge remote-tracking branch 'origin/fix-build-issues' into python3
shreyasnagare Jun 11, 2021
19787ae
Bump mongo version
shreyasnagare Jun 15, 2021
dbf4ec0
Install latest mongodb-org
shreyasnagare Jun 15, 2021
89a39dd
Bump Ubuntu version to 20.04 for tests
shreyasnagare Jun 15, 2021
7dd0254
Add packagecloud keys for rabbitmq and erlang
shreyasnagare Jun 15, 2021
ef2c070
Test erlang fixes
shreyasnagare Jun 15, 2021
e5442db
Use ubuntu container
shreyasnagare Jun 15, 2021
434d4dd
Fix test_bd.yml
shreyasnagare Jun 15, 2021
bd9f2e8
Remove sudo
shreyasnagare Jun 15, 2021
b366976
Revert erlang fixes
shreyasnagare Jun 15, 2021
b49f2df
fixes for python3-BD
sud335 Jun 29, 2021
54087cd
Merge remote-tracking branch 'origin/master' into python3
sud335 Jul 16, 2021
2bbe28c
Reformat Code
sud335 Jul 16, 2021
e2a2444
Update test_bd.yml
sud335 Jul 16, 2021
450c435
Update test_bd.yml
sud335 Jul 16, 2021
d4d48e7
Update test_bd.yml
sud335 Jul 16, 2021
5b0e60b
Update README.md
sud335 Jul 16, 2021
8ab3d05
Merge branch 'develop' into python3
sud335 Dec 15, 2021
d3a0ad4
Merge branch 'develop' into python3
sud335 Dec 24, 2021
1b670ed
Merge branch 'develop' into python3
sud335 Jun 2, 2022
92e8b0b
Update test_bd.yml
shreyasnagare Jun 2, 2022
3541de6
Update test_bd.yml
sud335 Jun 2, 2022
783d559
Merge pull request #113 from synergylabs/python3
sud335 Jun 2, 2022
687a01d
updates deprecated mongodb methods in setup.py
sud335 Sep 26, 2022
3707ddf
updates installation script for latest mongodb 6.0 release
sud335 Sep 26, 2022
176ad71
updates package versions for flask and other packages
sud335 Sep 26, 2022
2d8993c
updates github actions to include 20.04
sud335 Sep 26, 2022
d1dfd36
updates github actions installation script
sud335 Sep 26, 2022
4c4e55c
updates github actions installation script
sud335 Sep 26, 2022
eaa8a95
updates installation scripts
sud335 Sep 27, 2022
c663e94
updates installation scripts
sud335 Sep 27, 2022
8c44d9f
updates documentation bugfixes for v3.3
sud335 Sep 28, 2022
75ee3d1
Merge pull request #116 from synergylabs/python3
sud335 Sep 28, 2022
e4e89f0
bug fixes
sud335 Oct 11, 2022
090a69d
Merge pull request #117 from synergylabs/python3
sud335 Oct 11, 2022
597ae61
Merge branch 'master' into develop
sud335 Dec 12, 2023
50cbb59
Update test_bd.yml
sud335 Dec 12, 2023
f5c84da
fixes broken apis for packages - rabbbitmq, influx, mongo
sud335 Jan 17, 2024
b5b9718
fixes installation
sud335 Jan 18, 2024
1b87684
updates package versions
sud335 Jan 18, 2024
ff4d88c
updates package versions
sud335 Jan 18, 2024
a9ce924
updates pip_package versions
sud335 Jan 18, 2024
28977ba
updates ci tool
sud335 Jan 18, 2024
f963bde
debug ci tool error
sud335 Jan 22, 2024
459610d
debug ci tool error
sud335 Jan 22, 2024
1dda212
debug ci tool error
sud335 Jan 22, 2024
f48a0ca
possibly fixes node ci tool based on https://github.com/node-fetch/no…
sud335 Jan 22, 2024
6878a42
debug ci tool error
sud335 Jan 22, 2024
5cab51e
fixes issues with deprecated functions
sud335 Jan 22, 2024
e71ba9f
changes to fix deprecated functions in pymongo
sud335 Jan 23, 2024
845c9ce
fixes deprecated collection.update based on https://pymongo.readthedo…
sud335 Jan 23, 2024
5c09315
fixes deprecated code in apps.py
sud335 Jan 23, 2024
b2baf8d
fixes deprecated code in Dataservice/helper.py
sud335 Jan 23, 2024
7ac852a
possibly fixes rabbitmq bugs
sud335 Jan 23, 2024
b92daa8
fixes to deprecated pymongo apis - remove/count
sud335 Jan 24, 2024
39217c4
fixes rabbitmq issues, timeseries, responses
sud335 Feb 21, 2024
b63792b
updates deprecated github actions
sud335 Feb 21, 2024
3780f42
updates installation script to add SSL for rabbitmq
sud335 Feb 21, 2024
be2140e
add rabbitmq config and posthook scripts
sud335 Feb 21, 2024
fcc5ead
updates actions
sud335 Feb 21, 2024
8f47ac7
updates github actions
sud335 Feb 21, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 24 additions & 25 deletions .github/workflows/test_bd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,35 +2,34 @@
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

name: BuildingDepot

on:
push:
branches:
- master
- develop
branches:
- master
- develop
pull_request:
branches:
- master
- develop
- develop
jobs:
build:

runs-on: ubuntu-18.04

runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v2
- name: Set up Python 2.7
uses: actions/setup-python@v1
with:
python-version: 2.7
- name: Install BuildingDepot
run: |
sudo bash -x ./script_for_github_actions.sh
- name: Initialize tests
run: |
cd benchmarking-tools/functional-testing-tool
npm install
- name: Run tests
run: |
cd benchmarking-tools/functional-testing-tool
npm test ./tests/all.js
- uses: actions/checkout@v4
- name: Set up Python 3.10
uses: actions/setup-python@v4
with:
python-version: "3.10"
architecture: x64
- name: Display Python version
run: python --version
- name: Install BuildingDepot
run: |
sudo bash -x ./script_for_github_actions.sh
- name: Initialize tests
run: |
cd benchmarking-tools/functional-testing-tool
npm install
- name: Run tests
run: |
cd benchmarking-tools/functional-testing-tool
npm test ./tests/all.js
25 changes: 14 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
BuildingDepot v3.2.9 ([link](https://buildingdepot.org/))
BuildingDepot v3.3 ([link](https://buildingdepot.org/))
====================

![BuildingDepot](https://github.com/synergylabs/BuildingDepot-v3/workflows/BuildingDepot/badge.svg)
Expand Down Expand Up @@ -89,12 +89,12 @@ What's installed

* The following packages are installed using apt-get
* openssl
* python-setuptools
* python-dev
* python3-setuptools
* python3-dev
* build-essential
* python-software-properties
* python3-software-properties
* mongodb
* python-pip
* python3-pip
* nginx
* supervisor
* redis-server
Expand All @@ -103,15 +103,18 @@ What's installed
* The following packages are installed in the python virtual environment
* Flask
* mongoengine
* flask-restful
* Flask-HTTPAuth
* flask-login
* validate-email
* requests
* Flask-Login
* Flask-Script
* Flask-OAuthlib
* jsonschema
* pika
* Sphinx
* sphinx-theme
* Flask-WTF
* flask-bootstrap
* Flask-Bootstrap
* uWSGI
* redis
* influxdb
* pymongo
* aniso8601
* firebase-admin
34 changes: 17 additions & 17 deletions benchmarking-tools/BD-Performance-Test/config.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
{
"uri":{
"cs":"https://localhost:81",
"ds":"https://localhost:82"
},
"credentials":{
"clientId" : "",
"clientSecret" : ""
},
"defaults":{
"oauth":true,
"connections":1,
"amount":1
},
"testSuite":"./testSuites/post-time-series.json",
"headers":{
"content-type":"application/json"
}
"uri": {
"cs": "https://localhost:81",
"ds": "https://localhost:82"
},
"credentials": {
"clientId": "",
"clientSecret": ""
},
"defaults": {
"oauth": true,
"connections": 1,
"amount": 1
},
"testSuite": "./testSuites/post-time-series.json",
"headers": {
"content-type": "application/json"
}
}
13 changes: 5 additions & 8 deletions benchmarking-tools/BD-Performance-Test/lib/performanceTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ let addTestSuite = async function (testSuite) {
let updateInterval = await oAuthHandler.handle();
if (testSuite.delay !== undefined) {
await delay.inMilliseconds(testSuite.delay)
}
else if (config.defaults.delay !== undefined) {
} else if (config.defaults.delay !== undefined) {
await delay.inMilliseconds(config.defaults.delay)
}
for (let test of testSuite.tests) {
Expand All @@ -26,8 +25,7 @@ let addTestSuite = async function (testSuite) {
let options = await testOptions.create(test);
if (test.test === "create sensors for performance-testing") {
await createSensors.runTest(options);
}
else {
} else {
await runTest(options);
}
}
Expand All @@ -39,15 +37,14 @@ let addTestSuite = async function (testSuite) {
* Create test suite.
*/
let createTestSuite = async function (test) {
if(await testOptions.testExists(test)){
if (await testOptions.testExists(test)) {
return {
title: test,
tests: [{
title: test
}]
}
}
else{
} else {
console.log('Invalid testSuite or test!');
process.exit(1);
}
Expand All @@ -65,7 +62,7 @@ let runTest = async function (options) {
resolve(true)
}
};
if(options.title === undefined){
if (options.title === undefined) {
options.title = options.test;
}
console.log('\nTitle: ' + options.title + '\n'.padEnd(options.title.length + 8, '#'));
Expand Down
33 changes: 14 additions & 19 deletions benchmarking-tools/BD-Performance-Test/lib/testOptions.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ let formOptions = async function (test) {
if (test.duration !== undefined) {
delete options.amount
}
if(await isInvalidUri(options.uri)){
if (await isInvalidUri(options.uri)) {
options.url = uri[request.url];
}
if (request.idReplacement !== undefined)
Expand All @@ -25,32 +25,27 @@ let formOptions = async function (test) {
request.body = await dataGenerator.formData(options.formData.saveFile, options.formData.totalSensors, options.formData.totalSamples, options.formData.totalValues, options.formData.dynamic);
options['totalSensors'] = options.formData.totalSensors;
options['totalSamples'] = options.formData.totalSamples;
}
else if (request.formData !== undefined) {
} else if (request.formData !== undefined) {
request.body = await dataGenerator.formData(request.formData.saveFile, request.formData.totalSensors, request.formData.totalSamples, request.formData.totalValues, request.formData.dynamic);
options['totalSensors'] = request.formData.totalSensors;
options['totalSamples'] = request.formData.totalSamples;
}
else if (request.file !== undefined) {
} else if (request.file !== undefined) {
request.body = (test.file === undefined) ? (await fs.readFile(request.file)).toString() : (await fs.readFile(test.file)).toString();
}
else if (request.body !== undefined) {
} else if (request.body !== undefined) {
request.body = (test.body === undefined) ? JSON.stringify(request.body) : JSON.stringify(test.body);
}
else if (request.json !== undefined) {
} else if (request.json !== undefined) {
request.body = (test.json === undefined) ? request.json : test.json;
}
if (options.headers === undefined) {
options['headers'] = headers;
}
else {
} else {
Object.assign(options.headers, headers);
}
if (test.title !== undefined) {
options['title'] = test.title;
}
options['requests'] = [request];
if(options.amount !== undefined && options.connections > options.amount){
if (options.amount !== undefined && options.connections > options.amount) {
console.log("Number of requests can't be less than number of concurrent connections.")
process.exit(1)
}
Expand All @@ -70,20 +65,20 @@ let formOptions = async function (test) {
*/
let testExists = async function (test) {
let allTests = Object.keys(tests);
return (allTests.indexOf(test)>-1)
return (allTests.indexOf(test) > -1)
};

/**
* A function to check if the uri is valid
* @return {boolean} Returns true if uri is invalid, false otherwise.
*/
let isInvalidUri = async function (uri) {
let pattern = new RegExp('^(https?:\\/\\/)?'+ // protocol
'((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.)+[a-z]{2,}|'+ // domain name
'((\\d{1,3}\\.){3}\\d{1,3}))'+ // OR ip (v4) address
'(\\:\\d+)?(\\/[-a-z\\d%_.~+]*)*'+ // port and path
'(\\?[;&a-z\\d%_.~+=-]*)?'+ // query string
'(\\#[-a-z\\d_]*)?$','i'); // fragment locator
let pattern = new RegExp('^(https?:\\/\\/)?' + // protocol
'((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.)+[a-z]{2,}|' + // domain name
'((\\d{1,3}\\.){3}\\d{1,3}))' + // OR ip (v4) address
'(\\:\\d+)?(\\/[-a-z\\d%_.~+]*)*' + // port and path
'(\\?[;&a-z\\d%_.~+=-]*)?' + // query string
'(\\#[-a-z\\d_]*)?$', 'i'); // fragment locator
return !pattern.test(uri);
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ let handleTestResults = async function (res, options) {
res.requests['average2xx'] = (res.requests.total - res.non2xx) / res.duration;
res['pointPerSecond'] = res.requests['average2xx'] * options.totalSensors * options.totalSamples;
console.log('Total Requests: ' + res.requests.total + ' requests\nAverage RPS: ' + res.requests.average2xx + ' req/s\np99 Latency: ' + res.latency.p99 + ' ms\nTotal throughput: ' + res.throughput.total + ' Bytes\nAverage throughput: ' + res.throughput.average + ' Bytes/sec\nConnections: ' + res.connections + '\nDuration: ' + res.duration + ' seconds\nNon-2xx: ' + res.non2xx);
if(res.pointPerSecond){
if (res.pointPerSecond) {
console.log('Sensors: ' + options.totalSensors + '\nSamples: ' + options.totalSamples + '\nEffective points/sec: ' + res.pointPerSecond.toFixed(2) + ' points/sec written');
}
console.log('\n\n')
Expand Down
33 changes: 22 additions & 11 deletions benchmarking-tools/BD-Performance-Test/results/parse.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,23 @@
from __future__ import print_function
from os import listdir
import json
for f in listdir('.'):
if f == 'parse.py':
continue
with open('./'+f) as d:
try:
data = json.load(d)
print(data['title'] , data['requests']['total'] , data['requests']['average'] , data['latency']['p99'] , data['throughput']['total'] , data['throughput']['average'] , data['connections'] , data['duration'] , data['non2xx'], sep='\t')
except Exception as e:
pass
from os import listdir

for f in listdir("."):
if f == "parse.py":
continue
with open("./" + f) as d:
try:
data = json.load(d)
print(
data["title"],
data["requests"]["total"],
data["requests"]["average"],
data["latency"]["p99"],
data["throughput"]["total"],
data["throughput"]["average"],
data["connections"],
data["duration"],
data["non2xx"],
sep="\t",
)
except Exception as e:
pass
10 changes: 4 additions & 6 deletions benchmarking-tools/BD-Performance-Test/run.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,15 @@ let config = require('./config.json'),

if (process.argv[2] === undefined) {
testSuite = config.testSuite;
}
else {
} else {
testSuite = process.argv[2];
}

let runTestSuite = async function(testSuite){
if(await fileSystemHandler.exists(testSuite)){
let runTestSuite = async function (testSuite) {
if (await fileSystemHandler.exists(testSuite)) {
let testSuiteJSON = (await fileSystemHandler.readFile(testSuite)).toString();
run.addTestSuite(JSON.parse(testSuiteJSON));
}
else{
} else {
run.addTestSuite(await run.createTestSuite(testSuite));
}
};
Expand Down
2,003 changes: 2,002 additions & 1 deletion benchmarking-tools/BD-Performance-Test/sensors.json

Large diffs are not rendered by default.

52 changes: 27 additions & 25 deletions benchmarking-tools/BD-Performance-Test/test-suite.json
Original file line number Diff line number Diff line change
@@ -1,26 +1,28 @@
{ "title":"Different number of sensors:",
"defaults": {
"test": "post time-series data"
},
"tests": [
{
"title": "Post Time-series : 1000 sensors",
"formData": {
"saveFile": "log.json",
"totalSensors": 1000,
"totalSamples": 1,
"totalValues": 1,
"dynamic": true
}
},
{
"title": "Post Time-series : 1000 sensors",
"formData": {
"saveFile": "log.json",
"totalSensors": 1000,
"totalSamples": 1,
"totalValues": 1,
"dynamic": false
}
}]
{
"title": "Different number of sensors:",
"defaults": {
"test": "post time-series data"
},
"tests": [
{
"title": "Post Time-series : 1000 sensors",
"formData": {
"saveFile": "log.json",
"totalSensors": 1000,
"totalSamples": 1,
"totalValues": 1,
"dynamic": true
}
},
{
"title": "Post Time-series : 1000 sensors",
"formData": {
"saveFile": "log.json",
"totalSensors": 1000,
"totalSamples": 1,
"totalValues": 1,
"dynamic": false
}
}
]
}
Loading
Loading