Skip to content
Snippets Groups Projects
Commit bf0eecdf authored by gabin-dave's avatar gabin-dave
Browse files

lab2

parent 550b38e5
No related branches found
No related tags found
No related merge requests found
Showing
with 434 additions and 1 deletion
Azure_Lab2 @ 32c74a40
Subproject commit 32c74a40d91e67f22321b09e049522f96d5d100d
File added
{
"appService.zipIgnorePattern": [
"__pycache__{,/**}",
"*.py[cod]",
"*$py.class",
".Python{,/**}",
"build{,/**}",
"develop-eggs{,/**}",
"dist{,/**}",
"downloads{,/**}",
"eggs{,/**}",
".eggs{,/**}",
"lib{,/**}",
"lib64{,/**}",
"parts{,/**}",
"sdist{,/**}",
"var{,/**}",
"wheels{,/**}",
"share/python-wheels{,/**}",
"*.egg-info{,/**}",
".installed.cfg",
"*.egg",
"MANIFEST",
".env{,/**}",
".venv{,/**}",
"env{,/**}",
"venv{,/**}",
"ENV{,/**}",
"env.bak{,/**}",
"venv.bak{,/**}",
".vscode{,/**}"
]
}
\ No newline at end of file
File added
File added
File added
File added
locust -f locust.py -u 100 -r 5 --run-time 3m --host=http://127.0.0.1:5000/ --csv=locust_report --headless
import numpy as np
def numerical_integration(lower, upper, N):
x = np.linspace(lower, upper, N+1)
dx = (upper - lower) / N
y = np.abs(np.sin(x))
area = np.sum(y[:-1] * dx)
return area
Ns = [10, 100, 1000, 10000, 100000, 1000000]
results = [numerical_integration(0, np.pi, N) for N in Ns]
print(results)
File added
This diff is collapsed.
Azure_Lab2/Part1/local.png

107 KiB

import time
from locust import HttpUser, task, between
class NumericalIntegrationUser(HttpUser):
wait_time = between(1, 2)
@task
def hello_world(self):
self.client.get("numericalintegralservice/0/3.14159")
from flask import Flask
import numpy as np
from flask import Flask, jsonify
app = Flask(__name__)
@app.route('/numericalintegralservice/<lower>/<upper>')
def integrate(lower, upper):
def numerical_integration(lower, upper, N):
upper,lower=float(upper),float(lower)
x = np.linspace(lower, upper, N + 1)
dx = (upper - lower) / N
y = np.abs(np.sin(x))
area = np.sum(y[:-1] * dx)
return area
Ns = [10, 100, 1000, 10000, 100000, 1000000]
results = [numerical_integration(lower, upper, N) for N in Ns]
return jsonify(results)
if __name__ == '__main__':
app.run(debug=True)
\ No newline at end of file
File added
Azure_Lab2/Part2/Figure_1.png

90.1 KiB

locust -f locust.py -u 100 -r 5 --run-time 3m --host=http://52.143.162.232/ --csv=locust_report --headless
This diff is collapsed.
File added
import time
from locust import HttpUser, task, between
class NumericalIntegrationUser(HttpUser):
wait_time = between(1, 2)
@task
def hello_world(self):
self.client.get("numericalintegralservice/0/3.14159")
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment