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

Migrate benchmark to new server #3487

Merged
merged 4 commits into from
May 14, 2024
Merged
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
48 changes: 42 additions & 6 deletions benchmark/benchmark_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,16 +267,47 @@ def _get_git_revision_hash():
return subprocess.check_output(['git', 'rev-parse', 'HEAD']).decode("utf-8").strip()
except:
return None

def _get_commit_message():
try:
return subprocess.check_output(['git', 'log', '-1', '--pretty=%B']).decode("utf-8").strip()
except:
return None

def _get_commit_author():
try:
return subprocess.check_output(['git', 'log', '-1', "--pretty=%an"]).decode("utf-8").strip()
except:
return None

def _get_commit_email():
try:
return subprocess.check_output(['git', 'log', '-1', "--pretty=%ae"]).decode("utf-8").strip()
except:
return None

def get_run_info():
commit = {
'hash': os.environ.get('GITHUB_SHA', _get_git_revision_hash()),
'author': _get_commit_author(),
'email': _get_commit_email(),
'message': _get_commit_message()
}
return {
'commit_id': os.environ.get('GITHUB_SHA', _get_git_revision_hash()),
'run_timestamp': datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S"),
'commit': commit,
'timestamp': datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S"),
'note': args.note,
'dataset': args.dataset
}

def get_total_files_size(path):
total_size = 0
for dirpath, _, filenames in os.walk(path):
for f in filenames:
fp = os.path.join(dirpath, f)
total_size += os.path.getsize(fp)
return total_size


def get_query_info():
results = []
Expand All @@ -294,10 +325,11 @@ def get_query_info():
return results


def upload_benchmark_result():
def upload_benchmark_result(database_size=None):
run = get_run_info()
queries = get_query_info()
run['queries'] = queries
run['benchmarks'] = queries
run['database_size'] = database_size

response = requests.post(
benchmark_server_url, json=run, headers={
Expand Down Expand Up @@ -333,14 +365,18 @@ def upload_benchmark_result():
benchmark_group.load()

logging.info("Running benchmark...")
run_kuzu(serialized_graphs_path[args.dataset + '-ku'])
serialized_graph_path = serialized_graphs_path[args.dataset + '-ku']
run_kuzu(serialized_graph_path)
logging.info("Benchmark finished")

total_size = get_total_files_size(serialized_graph_path)
logging.info("Serialized dataset size: %d MiB", total_size / 1024 ** 2)

if is_dry_run:
logging.info("Dry run, skipping upload")
sys.exit(0)

# upload benchmark result and logs
logging.info("Uploading benchmark result...")
upload_benchmark_result()
upload_benchmark_result(total_size)
logging.info("Benchmark result uploaded")
Loading