Add stress testing script for multiple concurrent jobs - #8
Open
AdarshAlex751 wants to merge 1 commit into
Open
Conversation
There was a problem hiding this comment.
Pull request overview
Adds a standalone stress-test utility script to exercise the DistroML coordinator/worker stack by submitting multiple jobs concurrently, launching local worker processes for each job, polling /api/jobs for status, and emitting logs + a JSON summary report.
Changes:
- Introduces
scripts/stress_test_multiple_jobs.pyto submit N jobs concurrently and run N local workers. - Adds periodic status polling and a JSON report (latencies, outcomes, per-job details) written to
stress_test_logs/.
Suppressed comments (3)
scripts/stress_test_multiple_jobs.py:288
- If launching one of the workers fails, the script currently aborts before entering the polling
try/finally, leaving any already-started worker processes running and their log files open. Consider handling per-worker launch failures by terminating previously-started workers, closing log handles, and returning a non-zero exit code.
for job in submitted:
process, log_file = launch_worker(
job,
coordinator_url,
args.steps,
log_directory,
)
scripts/stress_test_multiple_jobs.py:379
- After adding a dedicated
cancelledcount, include it in the JSON report so the summary matches the printed/exit behavior and doesn't lump cancellations intostuck_or_unknown_jobs.
report = {
"requested_jobs": args.jobs,
"submitted_jobs": len(submitted),
"submission_failures": submission_errors,
"completed_jobs": completed,
"failed_jobs": failed,
"stuck_or_unknown_jobs": stuck,
"steps_per_job": args.steps,
scripts/stress_test_multiple_jobs.py:413
- If
cancelledis tracked separately, the script should still exit non-zero when any job is cancelled (since it isn't a successful completion). Update the exit condition to includecancelled == 0.
return 0 if failed == 0 and stuck == 0 else 1
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+150
to
+161
| log_path = log_directory / f"{job.name}.log" | ||
| log_file = log_path.open("w", encoding="utf-8") | ||
|
|
||
| process = subprocess.Popen( | ||
| command, | ||
| cwd=PROJECT_ROOT, | ||
| env=env, | ||
| stdout=log_file, | ||
| stderr=subprocess.STDOUT, | ||
| ) | ||
|
|
||
| return process, log_file |
| submission_errors.append(message) | ||
| print(f" SUBMISSION FAILED: {message}") | ||
|
|
||
| submitted.sort(key=lambda item: item.name) |
Comment on lines
+400
to
+402
| report_path = log_directory / ( | ||
| f"stress_report_{args.jobs}_jobs.json" | ||
| ) |
Comment on lines
+350
to
+357
| completed = sum( | ||
| job.final_status == "COMPLETED" for job in submitted | ||
| ) | ||
| failed = sum( | ||
| job.final_status == "FAILED" for job in submitted | ||
| ) | ||
| stuck = len(submitted) - completed - failed | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I finished the stress testing script and tested the system with 2, 5, and 10 concurrent jobs. All the jobs were submitted successfully, the worker processes finished without any errors, and the coordinator stayed responsive.
One issue I noticed is that the jobs stayed in the QUEUED state even after the workers completed and notified the coordinator. I didn't change this since it seems to be a coordinator issue and not included in my task.