-
Notifications
You must be signed in to change notification settings - Fork 3
added loop and latency args #58
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
base: main
Are you sure you want to change the base?
Changes from 3 commits
9f81bc4
0bbd173
da6804c
f0063c0
31a40d0
4eea0af
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -180,6 +180,64 @@ async def test_replay( | |||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| @pytest.mark.skipif("config.getoption('rust')", reason="rust does not support dumping") | ||||||||||||||||||||||||||||||||||||
| @pytest.mark.asyncio | ||||||||||||||||||||||||||||||||||||
| async def test_replay_looping( | ||||||||||||||||||||||||||||||||||||
| controller: None, | ||||||||||||||||||||||||||||||||||||
| reducer: Callable[[Optional[str]], Awaitable[None]], | ||||||||||||||||||||||||||||||||||||
| create_worker: Callable[[WorkerName], Awaitable[Worker]], | ||||||||||||||||||||||||||||||||||||
| create_ingester: Callable[[Ingester], Awaitable[Ingester]], | ||||||||||||||||||||||||||||||||||||
| stream_eiger: Callable[[zmq.Context[Any], int, int], Coroutine[Any, Any, None]], | ||||||||||||||||||||||||||||||||||||
| stream_orca: Callable[[zmq.Context[Any], int, int], Coroutine[Any, Any, None]], | ||||||||||||||||||||||||||||||||||||
| stream_small: Callable[[zmq.Context[Any], int, int], Coroutine[Any, Any, None]], | ||||||||||||||||||||||||||||||||||||
| tmp_path: Any, | ||||||||||||||||||||||||||||||||||||
| ) -> None: | ||||||||||||||||||||||||||||||||||||
| p_eiger, p_prefix, uuid = await dump_data( | ||||||||||||||||||||||||||||||||||||
| reducer, | ||||||||||||||||||||||||||||||||||||
| create_worker, | ||||||||||||||||||||||||||||||||||||
| create_ingester, | ||||||||||||||||||||||||||||||||||||
| stream_eiger, | ||||||||||||||||||||||||||||||||||||
| stream_orca, | ||||||||||||||||||||||||||||||||||||
| stream_small, | ||||||||||||||||||||||||||||||||||||
| tmp_path, | ||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||
| # read dump | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| par_file = generate_params(tmp_path) | ||||||||||||||||||||||||||||||||||||
| stop_event = threading.Event() | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| thread = threading.Thread( | ||||||||||||||||||||||||||||||||||||
| target=replay, | ||||||||||||||||||||||||||||||||||||
| args=( | ||||||||||||||||||||||||||||||||||||
| "tests.aux_payloads:TestWorker", | ||||||||||||||||||||||||||||||||||||
| "tests.aux_payloads:TestReducer", | ||||||||||||||||||||||||||||||||||||
| [p_eiger, f"{p_prefix}orca-ingester-{uuid}.cbors"], | ||||||||||||||||||||||||||||||||||||
| None, | ||||||||||||||||||||||||||||||||||||
| par_file, | ||||||||||||||||||||||||||||||||||||
| ), | ||||||||||||||||||||||||||||||||||||
| kwargs={"port": 5010, "stop_event": stop_event}, | ||||||||||||||||||||||||||||||||||||
|
Owner
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. if looping should be tested, an additional
Contributor
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. I resolved this by listening to the stop signal inside the replay loop - seems sensible to me, what do you think? |
||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||
| thread.start() | ||||||||||||||||||||||||||||||||||||
| await asyncio.sleep(2) | ||||||||||||||||||||||||||||||||||||
| single_run_len_results = 10 | ||||||||||||||||||||||||||||||||||||
| test_pass = False | ||||||||||||||||||||||||||||||||||||
| for _ in range(10): | ||||||||||||||||||||||||||||||||||||
| f = h5pyd.File("http://localhost:5010/", "r", timeout=5) | ||||||||||||||||||||||||||||||||||||
| logging.info("file %s", list(f.keys())) | ||||||||||||||||||||||||||||||||||||
| len_results = len(f.get("results", [])) | ||||||||||||||||||||||||||||||||||||
| logging.info("Length of results: %s", len_results) | ||||||||||||||||||||||||||||||||||||
| if len_results > single_run_len_results: | ||||||||||||||||||||||||||||||||||||
| test_pass = True | ||||||||||||||||||||||||||||||||||||
|
Owner
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.
Contributor
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. Oh! Is this because of the start frame? I thought the test streams defined in
Contributor
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. and in addition, I see in replay that event_number will just be passed though, but in the loop regime, perhaps we could artificially increment past the last recorded event number? I've drafted this in my last commit.
Owner
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.
The replay first creates its own recordings through dranspose/tests/test_replay.py Lines 107 to 123 in 5db108b
Contributor
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. This works now - I switched to checking that length is > 11, and I added the stop_event inside the loop for long-running (or infinite) loops so they can still be stopped sensibly (if stop_event gets set while still in the loop, a StopIteration is raised, so that we exit the loop according to the standard process. |
||||||||||||||||||||||||||||||||||||
| break | ||||||||||||||||||||||||||||||||||||
| await asyncio.sleep(1) | ||||||||||||||||||||||||||||||||||||
| assert test_pass, "Results never had more than 10 entries" | ||||||||||||||||||||||||||||||||||||
| logging.info("shut down server") | ||||||||||||||||||||||||||||||||||||
| stop_event.set() | ||||||||||||||||||||||||||||||||||||
| thread.join() | ||||||||||||||||||||||||||||||||||||
| await asyncio.sleep(0.1) | ||||||||||||||||||||||||||||||||||||
| logging.info("thread joined") | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| @pytest.mark.skipif("config.getoption('rust')", reason="rust does not support dumping") | ||||||||||||||||||||||||||||||||||||
| @pytest.mark.asyncio | ||||||||||||||||||||||||||||||||||||
| async def test_replay_gzip( | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
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.
why is that comment added?
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 think this the end-result of some uncommitted iterations in the code; Bob first just re-initialised
gensonStopIteration, but the final version switched to usingitertools.cycle. The comment can be removed.