-
Notifications
You must be signed in to change notification settings - Fork 86
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
upload benchmark copy query times to benchmark server #2099
Merged
Merged
Changes from 6 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
12632e8
upload benchmark copy query times to benchmark server
faed68c
bump Kuzu version to trigger copy queries
c07babb
bump Kuzu version to trigger copy queries
31cd401
fix formatting
f94a4cc
bump Kuzu version to trigger copy queries
93843ed
fix buffered output in serializer subprocess
297483f
fix buffered output in serializer subprocess
1106f51
fix copy query naming issues
fb666af
fix serializer subprocess logic
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ | |
import shutil | ||
import sys | ||
import subprocess | ||
import re | ||
|
||
base_dir = os.path.dirname(os.path.realpath(__file__)) | ||
kuzu_exec_path = os.path.join( | ||
|
@@ -17,7 +18,7 @@ def _get_kuzu_version(): | |
return line.split(' ')[2].strip() | ||
|
||
|
||
def serialize(dataset_name, dataset_path, serialized_graph_path): | ||
def serialize(dataset_name, dataset_path, serialized_graph_path, benchmark_copy_log_dir): | ||
bin_version = _get_kuzu_version() | ||
|
||
if not os.path.exists(serialized_graph_path): | ||
|
@@ -48,14 +49,22 @@ def serialize(dataset_name, dataset_path, serialized_graph_path): | |
|
||
for s in serialize_queries: | ||
logging.info('Executing query: %s', s) | ||
try: | ||
# Run kuzu shell one query at a time. This ensures a new process is | ||
# created for each query to avoid memory leaks. | ||
subprocess.run([kuzu_exec_path, serialized_graph_path], | ||
input=(s + ";" + "\n").encode("ascii"), check=True) | ||
except subprocess.CalledProcessError as e: | ||
# Run kuzu shell one query at a time. This ensures a new process is | ||
# created for each query to avoid memory leaks. | ||
process = subprocess.Popen([kuzu_exec_path, serialized_graph_path], | ||
stdin=subprocess.PIPE, stdout=subprocess.PIPE) | ||
process.stdin.write((s + ";" + "\n").encode("ascii")) | ||
process.stdin.close() | ||
match = re.match('copy (.*) from', s, re.IGNORECASE) | ||
for line in iter(process.stdout.readline, b''): | ||
print(line.decode("utf-8"), end='') | ||
if match: | ||
with open(os.path.join(benchmark_copy_log_dir, match.group(1) + '_log.txt'), 'ab') as f: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You should consider move this out of the |
||
f.write(line) | ||
process.wait() | ||
if process.returncode != 0: | ||
logging.error('Error executing query: %s', s) | ||
raise e | ||
raise subprocess.CalledProcessError | ||
|
||
with open(os.path.join(serialized_graph_path, 'version.txt'), 'w') as f: | ||
f.write(bin_version) | ||
|
@@ -66,8 +75,9 @@ def serialize(dataset_name, dataset_path, serialized_graph_path): | |
dataset_name = sys.argv[1] | ||
dataset_path = sys.argv[2] | ||
serialized_graph_path = sys.argv[3] | ||
benchmark_copy_log_dir = sys.argv[4] | ||
try: | ||
serialize(dataset_name, dataset_path, serialized_graph_path) | ||
serialize(dataset_name, dataset_path, serialized_graph_path, benchmark_copy_log_dir) | ||
except Exception as e: | ||
logging.error('Error serializing dataset %s', dataset_name) | ||
logging.error(e) | ||
|
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -79,4 +79,4 @@ height | |
-LOG ReturnDBVersion | ||
-STATEMENT CALL db_version() RETURN version | ||
---- 1 | ||
v0.0.8.11 | ||
v0.0.8.12 |
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Try to switch to
sys.stdout.write
andsys.stdout.flush
to see if it solves the out of order issue