-
Notifications
You must be signed in to change notification settings - Fork 20
Update benchmark_requests.py #143
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
base: dev
Are you sure you want to change the base?
Update benchmark_requests.py #143
Conversation
This reverts commit c7f9fca.
| RESULTS_DIR = Path(__file__).parent / "results" | ||
| RESULTS_DIR.mkdir(exist_ok=True) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Default path should be benchmark/results.
| outfile = ( | ||
| timestamp = datetime.now().strftime("%Y%m%d_%H%M%S") | ||
| if output: | ||
| outfile = Path(output) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add a check to ensure path to the outfile exists. Make the parent directories if it does not exist.
| f"_[execution_mode={'par' if parallel else 'seq'}]" | ||
| ".csv" | ||
| ) | ||
| outfile = RESULTS_DIR / filename |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can simply compute and use the results dir here, since it is not being used anywhere else. Also, no need to make it a constant.
| """outfile = ( | ||
| output | ||
| if output | ||
| else ( | ||
| f"benchmark_[num_requests={num_requests}]_[max_workers={max_workers}]_" | ||
| f"[parallel={parallel}]_[route={route}]_[timeout={timeout}].csv" | ||
| ) | ||
| ) | ||
| )""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is this docstring?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
uhh this was old code, i thought it would be a god idea to keep this as a docstring in case a slip up happens 😅
| f.write("status,time\n") | ||
| f.writelines(f"{s},{t}\n" for s, t in zip(success, times, strict=False)) | ||
|
|
||
| print(f"Results saved to the following directory: {outfile}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
outfile is a file, not directory. So update the string to: Results saved to:
aditeyabaral
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please incorporate similar changes in the unauthenticated_csrf_token_expiry.py file as well.
|
@niffy-artist2876 any update on this PR? |
made all the required changes to benchmark_requests.py, had to delay work on this because of ISA
|
I might have to take some time to understand what the code does before incorporating such changes. |
#123 - Introduced a method such that the CSV files have a better naming convention and a separate folder for saving the CSV files
📌 Description
Please provide a concise summary of the changes:
🧱 Type of Change
requirements.txt,pyproject.toml🧪 How Has This Been Tested?
tests/unit/)tests/functional/)tests/integration/)✅ Checklist
scripts/run_tests.py)pre-commit run --all-files).envvars updated (if applicable)scripts/benchmark/benchmark_requests.py)🛠️ Affected API Behaviour
app/app.py– Modified/authenticateroute logicapp/pesu.py– Updated scraping or authentication handling🧩 Models
app/models/request.py– Input validation or request schema changesapp/models/response.py– Authentication response formattingapp/models/profile.py– Profile extraction logic🐳 DevOps & Config
Dockerfile– Changes to base image or build process.github/workflows/*.yaml– CI/CD pipeline or deployment updatespyproject.toml/requirements.txt– Dependency version changes.pre-commit-config.yaml– Linting or formatting hook changes📊 Benchmarks & Analysis
scripts/benchmark_auth.py– Performance or latency measurement changesscripts/analyze_benchmark.py– Benchmark result analysis changesscripts/run_tests.py– Custom test runner logic or behavior updates📸 Screenshots / API Demos (if applicable)
🧠 Additional Notes (if applicable)