Skip to content
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

[ft-benchmark] fill actor and context db fields properly #11663

Merged
merged 1 commit into from
Jun 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions scripts/ft-benchmark-data-sender.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,11 @@ def commit_to_db(data: dict) -> None:
type=int,
required=True,
help='Number of users')
parser.add_argument('--user', type=str, default='unknown', help='User name')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: I think user is a bit ambiguous here. initiator might be clearer and would be in line with the db column name. (In the postgres db naming a column user lead to lint errors, so instead it's named initiator.)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, it would be better to do this naming consistent with db scheme, but then I will need rename this across all files so probably will do it in another PR

parser.add_argument('--context',
type=str,
default='unknown',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Perhaps make user and context required arguments without default, to make sure these fields have meaningful values.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe I agree, but maybe some time we will prefer to see row in db with unknown, unknown rather than see nothing. If you strongly confident that we want this arguments be required let me know I will change them

help='Context')
args = parser.parse_args()
DURATION = args.duration / 3600

Expand Down Expand Up @@ -153,7 +158,7 @@ def commit_to_db(data: dict) -> None:
"size_state_bytes": state_size,
"tps": int(average_tps),
"total_transactions": int(processed_transactions[-1]),
"initiator": "crt cron job",
"context": "continuous benchmark run",
"initiator": args.user,
"context": args.context,
}
commit_to_db(response)
10 changes: 7 additions & 3 deletions scripts/run-ft-benchmark.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ def remove_lock_file() -> None:


def run_benchmark(repo_dir: str, time: str, users: int, shards: int, nodes: int,
rump_up: int) -> None:
rump_up: int, user: str, context: str) -> None:
benchmark_command = (
f"./scripts/start-benchmark.sh {time} {users} {shards} {nodes} {rump_up}"
f"./scripts/start-benchmark.sh {time} {users} {shards} {nodes} {rump_up} {user} {context}"
)
subprocess.run(benchmark_command, cwd=repo_dir, shell=True, check=True)

Expand All @@ -50,12 +50,16 @@ def main() -> None:
parser.add_argument('--nodes', type=int, default=1, help="Number of nodes")
parser.add_argument('--rump-up', type=int, default=10, help="Rump-up rate")
parser.add_argument('--user', type=str, default='unknown', help="User name")
parser.add_argument('--context',
type=str,
default='unknown',
help="Context")
args = parser.parse_args()
time_seconds = parse_timespan(args.time)
try:
create_lock_file(args.user)
run_benchmark(REPO_DIR, time_seconds, args.users, args.shards,
args.nodes, args.rump_up)
args.nodes, args.rump_up, args.user, args.context)
except RuntimeError as e:
print(e)
finally:
Expand Down
4 changes: 3 additions & 1 deletion scripts/start-benchmark.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ USERS=$2
SHARDS=$3
NODES=$4
RUMP_UP=$5
USER=$6
CONTEXT=$7

# Stop previous experiment
pkill -9 locust || true
Expand Down Expand Up @@ -33,6 +35,6 @@ sleep 30

# Run data collector
cd ~/nearcore
python3 scripts/ft-benchmark-data-sender.py --duration $TIME --users $USERS
python3 scripts/ft-benchmark-data-sender.py --duration $TIME --users $USERS --user $USER --context $CONTEXT

echo "Benchmark completed."
Loading