bug fix and tag (#8282)
This commit is contained in:
@@ -121,6 +121,12 @@ def parse_args():
|
|||||||
default="random",
|
default="random",
|
||||||
help="Policy for popping requests from the ready queue (random or fifo)",
|
help="Policy for popping requests from the ready queue (random or fifo)",
|
||||||
)
|
)
|
||||||
|
parser.add_argument(
|
||||||
|
"--tag",
|
||||||
|
type=str,
|
||||||
|
default="",
|
||||||
|
help="Tag of a certain run in the log file",
|
||||||
|
)
|
||||||
parser.add_argument("--seed", type=int, default=1, help="The random seed.")
|
parser.add_argument("--seed", type=int, default=1, help="The random seed.")
|
||||||
return parser.parse_args()
|
return parser.parse_args()
|
||||||
|
|
||||||
@@ -202,9 +208,9 @@ def gen_payload(prompt, output_len):
|
|||||||
return payload
|
return payload
|
||||||
|
|
||||||
|
|
||||||
def log_to_jsonl_file(data, file_path="performance_metrics.jsonl"):
|
def log_to_jsonl_file(data, file_path="performance_metrics.jsonl", tag=""):
|
||||||
"""Append the data with a timestamp to the specified JSONL file."""
|
"""Append the data with a timestamp and tag to the specified JSONL file."""
|
||||||
timestamped_data = {"timestamp": datetime.now().isoformat(), **data}
|
timestamped_data = {"timestamp": datetime.now().isoformat(), "tag": tag, **data}
|
||||||
try:
|
try:
|
||||||
with open(file_path, "a") as file:
|
with open(file_path, "a") as file:
|
||||||
file.write(
|
file.write(
|
||||||
@@ -360,7 +366,7 @@ class WorkloadGenerator:
|
|||||||
# append new request to client's history
|
# append new request to client's history
|
||||||
self.client_records[client_id][
|
self.client_records[client_id][
|
||||||
"history"
|
"history"
|
||||||
] += self.sub_question_inputs.pop()
|
] += self.sub_question_inputs.pop().prompt
|
||||||
self.ready_queue.append(
|
self.ready_queue.append(
|
||||||
(
|
(
|
||||||
client_id,
|
client_id,
|
||||||
@@ -428,7 +434,7 @@ class WorkloadGenerator:
|
|||||||
print(
|
print(
|
||||||
f" Throughput: {performance_data['summary']['throughput']:.2f} requests per second"
|
f" Throughput: {performance_data['summary']['throughput']:.2f} requests per second"
|
||||||
)
|
)
|
||||||
log_to_jsonl_file(performance_data, args.log_file)
|
log_to_jsonl_file(performance_data, args.log_file, tag=args.tag)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|||||||
Reference in New Issue
Block a user