-
Notifications
You must be signed in to change notification settings - Fork 344
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
End-to-end testing of python logging -> store ingestion #1817
Merged
Merged
Changes from 8 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
f059935
Sort the arguments to `rerun`
emilk 5049391
Pass on `LogMsg::Goodbye` just like any other message
emilk ad7064b
Add `rerun --test-receive`
emilk 9d2fbe9
`just py-build --quiet` is now possible
emilk 043a86f
Add scripts/run_python_e2e_test.py
emilk 6385ad3
replace `cargo r -p rerun` with `python3 -m rerun`
emilk 8e9af73
lint and explain choice of examples
emilk e2e5981
Add to CI
emilk 3778db9
check returncode
emilk 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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 |
---|---|---|
@@ -0,0 +1,77 @@ | ||
#!/usr/bin/env python3 | ||
|
||
""" | ||
Run some of our python exeamples, piping their log stream to the rerun process. | ||
|
||
This is an end-to-end test for testing: | ||
* Our Python API | ||
* LogMsg encoding/decoding | ||
* Arrow encoding/decoding | ||
* TCP connection | ||
* Data store ingestion | ||
""" | ||
|
||
import os | ||
import subprocess | ||
import sys | ||
import time | ||
|
||
|
||
def main() -> None: | ||
build_env = os.environ.copy() | ||
if "RUST_LOG" in build_env: | ||
del build_env["RUST_LOG"] # The user likely only meant it for the actual tests; not the setup | ||
|
||
print("----------------------------------------------------------") | ||
print("Building rerun-sdk…") | ||
start_time = time.time() | ||
subprocess.Popen(["just", "py-build", "--quiet"], env=build_env).wait() | ||
elapsed = time.time() - start_time | ||
print(f"rerun-sdk built in {elapsed:.1f} seconds") | ||
print("") | ||
|
||
examples = [ | ||
# Trivial examples that don't require weird dependencies, or downloading data | ||
"examples/python/api_demo/main.py", | ||
"examples/python/car/main.py", | ||
"examples/python/multithreading/main.py", | ||
"examples/python/plots/main.py", | ||
"examples/python/text_logging/main.py", | ||
] | ||
for example in examples: | ||
print("----------------------------------------------------------") | ||
print(f"Testing {example}…\n") | ||
start_time = time.time() | ||
run_example(example) | ||
elapsed = time.time() - start_time | ||
print(f"{example} done in {elapsed:.1f} seconds") | ||
print() | ||
|
||
print() | ||
print("All tests passed successfully!") | ||
|
||
|
||
def run_example(example: str) -> None: | ||
port = 9752 | ||
|
||
# sys.executable: the absolute path of the executable binary for the Python interpreter | ||
python_executable = sys.executable | ||
if python_executable is None: | ||
python_executable = "python3" | ||
|
||
rerun_process = subprocess.Popen( | ||
[python_executable, "-m", "rerun", "--port", str(port), "--strict", "--test-receive"] | ||
) | ||
time.sleep(0.3) # Wait for rerun server to start to remove a logged warning | ||
|
||
python_process = subprocess.Popen([python_executable, example, "--connect", "--addr", f"127.0.0.1:{port}"]) | ||
|
||
print("Waiting for python process to finish…") | ||
python_process.wait(timeout=30) | ||
|
||
print("Waiting for rerun process to finish…") | ||
rerun_process.wait(timeout=30) | ||
emilk marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
|
||
if __name__ == "__main__": | ||
main() |
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.
If we are running this as part of the wheel job, there's not a great reason to run:
below. The wheel is installed into the local environment just a few lines up from here.
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.
True, but when running it from the command line it's quite useful… I guess I could make it opt-out
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.
Let's see how much time it adds to the CI
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.
It didn't run: https://github.com/rerun-io/rerun/actions/runs/4669414069/jobs/8267852033 wth
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.
I believe you can silently skip it if the
CI
env var is set.