Skip to content

Commit b186419

Browse files
committed
removing extraneous files
1 parent aee3f6a commit b186419

File tree

2 files changed

+60
-29
lines changed

2 files changed

+60
-29
lines changed

.gitignore

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,4 @@ pip-selfcheck.json
2626
.vscode
2727

2828
# Backup files
29-
*.bak
30-
29+
*.bak

stressTest.py

Lines changed: 59 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -5,59 +5,91 @@
55
import sys
66
from config import Config
77

8-
def run_stress_test(num_submissions, submission_delay, autograder_image, output_file, tango_port, tango_path, job_name, job_path):
9-
with open(output_file, 'a') as f:
8+
9+
def run_stress_test(
10+
num_submissions,
11+
submission_delay,
12+
autograder_image,
13+
output_file,
14+
tango_port,
15+
tango_path,
16+
job_name,
17+
job_path,
18+
):
19+
with open(output_file, "a") as f:
1020
f.write(f"Stress testing with {num_submissions} submissions\n")
1121
for i in range(1, num_submissions + 1):
1222
command = [
13-
'python3', os.path.join(tango_path, 'clients/tango-cli.py'),
14-
'-P', str(tango_port),
15-
'-k', 'test',
16-
'-l', job_name,
17-
'--runJob', job_path,
18-
'--image', autograder_image
23+
"python3",
24+
os.path.join(tango_path, "clients/tango-cli.py"),
25+
"-P",
26+
str(tango_port),
27+
"-k",
28+
"test",
29+
"-l",
30+
job_name,
31+
"--runJob",
32+
job_path,
33+
"--image",
34+
autograder_image,
1935
]
20-
subprocess.run(command, stdout = f, stderr = f)
21-
f.write(f"Submission {i} submitted \n")
36+
subprocess.run(command, stdout=f, stderr=f)
37+
f.write(f"Submission {i} submitted \n")
2238

2339
if submission_delay > 0:
2440
time.sleep(submission_delay)
25-
41+
2642
sys.exit()
2743

44+
2845
def get_metrics(output_file):
2946
if Config.LOGFILE == None:
3047
print("Make sure logs are recorded in a log file")
3148

3249
job_times = []
33-
with open(Config.LOGFILE, 'r') as f:
50+
with open(Config.LOGFILE, "r") as f:
3451
for line in f:
3552
if "finished after " in line:
3653
start = line.find("finished after ") + len("finished after ")
3754
seconds = int(line[start:].split()[0])
3855
job_times.append(seconds)
39-
40-
with open(output_file, 'a') as f:
56+
57+
with open(output_file, "a") as f:
4158
if len(job_times) == 0:
4259
print("No jobs have been completed")
4360
else:
44-
avg = sum(job_times)/len(job_times)
61+
avg = sum(job_times) / len(job_times)
4562
f.write(f"Average job time is {avg} seconds \n")
46-
63+
4764
sys.exit()
4865

4966

5067
if __name__ == "__main__":
5168
parser = argparse.ArgumentParser(description="Stress test script for Tango")
52-
parser.add_argument('--num_submissions', type=int, default=10, help="Number of submissions")
53-
parser.add_argument('--submission_delay', type=float, default=1.0, help="Delay between submissions")
54-
parser.add_argument('--autograder_image', type=str, required=True, help="Autograder image")
55-
parser.add_argument('--output_file', type=str, default='stress_test.out', help="Output file")
56-
parser.add_argument('--tango_port', type=int, default=4567, help="Tango server port")
57-
parser.add_argument('--tango_path', type=str, required=True, help="Path to Tango")
58-
parser.add_argument('--job_name', type=str, required=True, help="Name of the job")
59-
parser.add_argument('--job_path', type=str, required=True, help="Path to the job")
60-
parser.add_argument('--get_metrics', type=bool, default = False, help= "Set to true to get metrics, does not create new jobs")
69+
parser.add_argument(
70+
"--num_submissions", type=int, default=10, help="Number of submissions"
71+
)
72+
parser.add_argument(
73+
"--submission_delay", type=float, default=1.0, help="Delay between submissions"
74+
)
75+
parser.add_argument(
76+
"--autograder_image", type=str, required=True, help="Autograder image"
77+
)
78+
parser.add_argument(
79+
"--output_file", type=str, default="stress_test.out", help="Output file"
80+
)
81+
parser.add_argument(
82+
"--tango_port", type=int, default=4567, help="Tango server port"
83+
)
84+
parser.add_argument("--tango_path", type=str, required=True, help="Path to Tango")
85+
parser.add_argument("--job_name", type=str, required=True, help="Name of the job")
86+
parser.add_argument("--job_path", type=str, required=True, help="Path to the job")
87+
parser.add_argument(
88+
"--get_metrics",
89+
type=bool,
90+
default=False,
91+
help="Set to true to get metrics, does not create new jobs",
92+
)
6193

6294
args = parser.parse_args()
6395

@@ -72,5 +104,5 @@ def get_metrics(output_file):
72104
args.tango_port,
73105
args.tango_path,
74106
args.job_name,
75-
args.job_path
76-
)
107+
args.job_path,
108+
)

0 commit comments

Comments
 (0)