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

Propagate any errors occurring within the _BaseClient context #46

Merged
merged 6 commits into from
Apr 11, 2023

Conversation

charlesbmi
Copy link
Contributor

@charlesbmi charlesbmi commented Apr 7, 2023

Current behavior: any Exceptions occurring within a _BaseClient context exit the context but do not propagate any errors.

From https://docs.python.org/3/reference/datamodel.html#with-statement-context-managers about __exit__:

If an exception is supplied, and the method wishes to suppress the exception (i.e., prevent it from being propagated), it should return a true value. Otherwise, the exception will be processed normally upon exit from this method.

(Note that return self acts as a true value here)

New behavior: Exceptions are propagated through the context.

This helps user track down where an error came from.

@jasmainak
Copy link
Member

seems fair to me. Any possibility of adding a test?

@charlesbmi
Copy link
Contributor Author

Thanks @jasmainak ! Added a test to check that the error gets propagated up to the user.

@larsoner
Copy link
Member

Looks like this uncovered a real bug in our code/test:

================================== FAILURES ===================================
_______________________________ test_lsl_client _______________________________
mne_realtime\tests\test_lsl_client.py:32: in test_lsl_client
    epoch = client.get_data_as_epoch(n_samples=sfreq * n_secs * 2)
mne_realtime\lsl_client.py:73: in get_data_as_epoch
    samples, _ = self.client.pull_chunk(max_samples=n_samples,
C:\hostedtoolcache\windows\Python\3.9.13\x64\lib\site-packages\pylsl\pylsl.py:846: in pull_chunk
    self.buffers[max_samples] = ((self.value_type * max_values)(),
E   TypeError: can't multiply sequence by non-int of type 'float'

maybe it just needs a np.array(...) cast or something... do you want to try @charlesincharge ?

…n_samples, but sfreq * n_secs * 2 is (often) a float
@charlesbmi
Copy link
Contributor Author

charlesbmi commented Apr 10, 2023

@larsoner I pushed 4c82e98 to fix that bug in test_lsl_client.py; .get_data_as_epoch() needed an int for n_samples . I'll also open a PR on pylsl to give a more helpful error message there.

After fixing the n_samples int issue, the test continues much further but eventually freezes on something and requires a Ctrl-C to exit it. I'm not quite sure what the issue is. Have you seen this before?

(mne-realtime) ➜  mne-realtime git:(client-exit-propagate-error) ✗ pytest mne_realtime/tests/test_lsl_client.py                                      git:(client-exit-propagate-error|✚1…1⚑1
==================================================================================== test session starts =====================================================================================
platform darwin -- Python 3.11.2, pytest-7.1.2, pluggy-1.0.0
rootdir: /Users/charles/Development/mne-realtime, configfile: setup.cfg
plugins: cov-4.0.0
collected 1 item

mne_realtime/tests/test_lsl_client.py /Users/charles/mambaforge/envs/mne-realtime/lib/python3.11/site-packages/coverage/inorout.py:460: CoverageWarning: --include is ignored because --source is set (include-ignored)
  self.warn("--include is ignored because --source is set", slug="include-ignored")
/Users/charles/mambaforge/envs/mne-realtime/lib/python3.11/site-packages/coverage/inorout.py:460: CoverageWarning: --include is ignored because --source is set (include-ignored)
  self.warn("--include is ignored because --source is set", slug="include-ignored")
2023-04-10 10:22:58.939 (   0.725s) [           2E177]      netinterfaces.cpp:91    INFO| netif 'lo0' (status: 32768, multicast: 1, broadcast: 0)
2023-04-10 10:22:58.939 (   0.725s) [           2E177]      netinterfaces.cpp:91    INFO| netif 'lo0' (status: 32768, multicast: 1, broadcast: 0)
2023-04-10 10:22:58.939 (   0.725s) [           2E177]      netinterfaces.cpp:102   INFO| 	IPv4 addr: 7f000001
2023-04-10 10:22:58.939 (   0.725s) [           2E177]      netinterfaces.cpp:91    INFO| netif 'lo0' (status: 32768, multicast: 1, broadcast: 0)
2023-04-10 10:22:58.939 (   0.725s) [           2E177]      netinterfaces.cpp:105   INFO| 	IPv6 addr: ::1
2023-04-10 10:22:58.939 (   0.725s) [           2E177]      netinterfaces.cpp:91    INFO| netif 'lo0' (status: 32768, multicast: 1, broadcast: 0)
2023-04-10 10:22:58.939 (   0.725s) [           2E177]      netinterfaces.cpp:105   INFO| 	IPv6 addr: fe80::1%lo0
2023-04-10 10:22:58.939 (   0.725s) [           2E177]      netinterfaces.cpp:91    INFO| netif 'gif0' (status: 32768, multicast: 0, broadcast: 0)
2023-04-10 10:22:58.939 (   0.725s) [           2E177]      netinterfaces.cpp:91    INFO| netif 'stf0' (status: 0, multicast: 0, broadcast: 0)
2023-04-10 10:22:58.939 (   0.725s) [           2E177]      netinterfaces.cpp:91    INFO| netif 'anpi0' (status: 32768, multicast: 1, broadcast: 2)
2023-04-10 10:22:58.939 (   0.725s) [           2E177]      netinterfaces.cpp:91    INFO| netif 'anpi0' (status: 32768, multicast: 1, broadcast: 2)
2023-04-10 10:22:58.939 (   0.725s) [           2E177]      netinterfaces.cpp:105   INFO| 	IPv6 addr: fe80::a077:33ff:feb6:d59e%anpi0
2023-04-10 10:22:58.939 (   0.725s) [           2E177]      netinterfaces.cpp:91    INFO| netif 'anpi2' (status: 32768, multicast: 1, broadcast: 2)
2023-04-10 10:22:58.939 (   0.725s) [           2E177]      netinterfaces.cpp:91    INFO| netif 'anpi2' (status: 32768, multicast: 1, broadcast: 2)
2023-04-10 10:22:58.939 (   0.725s) [           2E177]      netinterfaces.cpp:105   INFO| 	IPv6 addr: fe80::a077:33ff:feb6:d5a0%anpi2
2023-04-10 10:22:58.939 (   0.725s) [           2E177]      netinterfaces.cpp:91    INFO| netif 'anpi1' (status: 32768, multicast: 1, broadcast: 2)
2023-04-10 10:22:58.939 (   0.725s) [           2E177]      netinterfaces.cpp:91    INFO| netif 'anpi1' (status: 32768, multicast: 1, broadcast: 2)
2023-04-10 10:22:58.939 (   0.725s) [           2E177]      netinterfaces.cpp:105   INFO| 	IPv6 addr: fe80::a077:33ff:feb6:d59f%anpi1
2023-04-10 10:22:58.939 (   0.725s) [           2E177]      netinterfaces.cpp:91    INFO| netif 'en4' (status: 32768, multicast: 1, broadcast: 2)
2023-04-10 10:22:58.939 (   0.725s) [           2E177]      netinterfaces.cpp:91    INFO| netif 'en5' (status: 32768, multicast: 1, broadcast: 2)
2023-04-10 10:22:58.939 (   0.725s) [           2E177]      netinterfaces.cpp:91    INFO| netif 'en6' (status: 32768, multicast: 1, broadcast: 2)
2023-04-10 10:22:58.939 (   0.725s) [           2E177]      netinterfaces.cpp:91    INFO| netif 'en1' (status: 32768, multicast: 1, broadcast: 2)
2023-04-10 10:22:58.939 (   0.725s) [           2E177]      netinterfaces.cpp:91    INFO| netif 'en2' (status: 32768, multicast: 1, broadcast: 2)
2023-04-10 10:22:58.939 (   0.725s) [           2E177]      netinterfaces.cpp:91    INFO| netif 'en3' (status: 32768, multicast: 1, broadcast: 2)
2023-04-10 10:22:58.939 (   0.725s) [           2E177]      netinterfaces.cpp:91    INFO| netif 'bridge0' (status: 32768, multicast: 1, broadcast: 2)
2023-04-10 10:22:58.939 (   0.725s) [           2E177]      netinterfaces.cpp:91    INFO| netif 'ap1' (status: 32768, multicast: 0, broadcast: 2)
2023-04-10 10:22:58.939 (   0.725s) [           2E177]      netinterfaces.cpp:91    INFO| netif 'en0' (status: 32768, multicast: 1, broadcast: 2)
2023-04-10 10:22:58.939 (   0.725s) [           2E177]      netinterfaces.cpp:91    INFO| netif 'en0' (status: 32768, multicast: 1, broadcast: 2)
2023-04-10 10:22:58.939 (   0.725s) [           2E177]      netinterfaces.cpp:105   INFO| 	IPv6 addr: fe80::1490:8080:54a8:15f9%en0
2023-04-10 10:22:58.939 (   0.725s) [           2E177]      netinterfaces.cpp:91    INFO| netif 'en0' (status: 32768, multicast: 1, broadcast: 2)
2023-04-10 10:22:58.939 (   0.725s) [           2E177]      netinterfaces.cpp:102   INFO| 	IPv4 addr: a081e54
2023-04-10 10:22:58.939 (   0.725s) [           2E177]      netinterfaces.cpp:91    INFO| netif 'awdl0' (status: 32768, multicast: 1, broadcast: 2)
2023-04-10 10:22:58.939 (   0.725s) [           2E177]      netinterfaces.cpp:91    INFO| netif 'awdl0' (status: 32768, multicast: 1, broadcast: 2)
2023-04-10 10:22:58.939 (   0.725s) [           2E177]      netinterfaces.cpp:105   INFO| 	IPv6 addr: fe80::905e:3eff:fec5:e8f2%awdl0
2023-04-10 10:22:58.939 (   0.725s) [           2E177]      netinterfaces.cpp:91    INFO| netif 'llw0' (status: 32768, multicast: 1, broadcast: 2)
2023-04-10 10:22:58.939 (   0.725s) [           2E177]      netinterfaces.cpp:91    INFO| netif 'llw0' (status: 32768, multicast: 1, broadcast: 2)
2023-04-10 10:22:58.939 (   0.725s) [           2E177]      netinterfaces.cpp:105   INFO| 	IPv6 addr: fe80::905e:3eff:fec5:e8f2%llw0
2023-04-10 10:22:58.939 (   0.725s) [           2E177]      netinterfaces.cpp:91    INFO| netif 'utun0' (status: 32768, multicast: 1, broadcast: 0)
2023-04-10 10:22:58.939 (   0.725s) [           2E177]      netinterfaces.cpp:91    INFO| netif 'utun0' (status: 32768, multicast: 1, broadcast: 0)
2023-04-10 10:22:58.939 (   0.725s) [           2E177]      netinterfaces.cpp:105   INFO| 	IPv6 addr: fe80::ad6e:4302:db69:932a%utun0
2023-04-10 10:22:58.939 (   0.725s) [           2E177]      netinterfaces.cpp:91    INFO| netif 'utun1' (status: 32768, multicast: 1, broadcast: 0)
2023-04-10 10:22:58.939 (   0.725s) [           2E177]      netinterfaces.cpp:91    INFO| netif 'utun1' (status: 32768, multicast: 1, broadcast: 0)
2023-04-10 10:22:58.939 (   0.725s) [           2E177]      netinterfaces.cpp:105   INFO| 	IPv6 addr: fe80::9892:4496:3c65:2df8%utun1
2023-04-10 10:22:58.939 (   0.725s) [           2E177]      netinterfaces.cpp:91    INFO| netif 'utun2' (status: 32768, multicast: 1, broadcast: 0)
2023-04-10 10:22:58.939 (   0.725s) [           2E177]      netinterfaces.cpp:91    INFO| netif 'utun2' (status: 32768, multicast: 1, broadcast: 0)
2023-04-10 10:22:58.939 (   0.725s) [           2E177]      netinterfaces.cpp:105   INFO| 	IPv6 addr: fe80::ce81:b1c:bd2c:69e%utun2
2023-04-10 10:22:58.939 (   0.725s) [           2E177]      netinterfaces.cpp:91    INFO| netif 'utun3' (status: 32768, multicast: 1, broadcast: 0)
2023-04-10 10:22:58.939 (   0.725s) [           2E177]      netinterfaces.cpp:91    INFO| netif 'utun3' (status: 32768, multicast: 1, broadcast: 0)
2023-04-10 10:22:58.939 (   0.725s) [           2E177]      netinterfaces.cpp:105   INFO| 	IPv6 addr: fe80::ed71:6592:4dbd:9c47%utun3
2023-04-10 10:22:58.939 (   0.725s) [           2E177]      netinterfaces.cpp:91    INFO| netif 'utun4' (status: 32768, multicast: 1, broadcast: 0)
2023-04-10 10:22:58.939 (   0.725s) [           2E177]      netinterfaces.cpp:91    INFO| netif 'utun4' (status: 32768, multicast: 1, broadcast: 0)
2023-04-10 10:22:58.939 (   0.725s) [           2E177]      netinterfaces.cpp:105   INFO| 	IPv6 addr: fe80::f58c:6082:9735:f3f6%utun4
2023-04-10 10:22:58.939 (   0.725s) [           2E177]         api_config.cpp:270   INFO| Loaded default config
2023-04-10 10:22:58.943 (   0.000s) [           2E187]      netinterfaces.cpp:91    INFO| netif 'lo0' (status: 32768, multicast: 1, broadcast: 0)
2023-04-10 10:22:58.943 (   0.000s) [           2E187]      netinterfaces.cpp:91    INFO| netif 'lo0' (status: 32768, multicast: 1, broadcast: 0)
2023-04-10 10:22:58.943 (   0.000s) [           2E187]      netinterfaces.cpp:102   INFO| 	IPv4 addr: 7f000001
2023-04-10 10:22:58.943 (   0.000s) [           2E187]      netinterfaces.cpp:91    INFO| netif 'lo0' (status: 32768, multicast: 1, broadcast: 0)
2023-04-10 10:22:58.943 (   0.000s) [           2E187]      netinterfaces.cpp:105   INFO| 	IPv6 addr: ::1
2023-04-10 10:22:58.943 (   0.000s) [           2E187]      netinterfaces.cpp:91    INFO| netif 'lo0' (status: 32768, multicast: 1, broadcast: 0)
2023-04-10 10:22:58.943 (   0.000s) [           2E187]      netinterfaces.cpp:105   INFO| 	IPv6 addr: fe80::1%lo0
2023-04-10 10:22:58.943 (   0.000s) [           2E187]      netinterfaces.cpp:91    INFO| netif 'gif0' (status: 32768, multicast: 0, broadcast: 0)
2023-04-10 10:22:58.943 (   0.000s) [           2E187]      netinterfaces.cpp:91    INFO| netif 'stf0' (status: 0, multicast: 0, broadcast: 0)
2023-04-10 10:22:58.943 (   0.000s) [           2E187]      netinterfaces.cpp:91    INFO| netif 'anpi0' (status: 32768, multicast: 1, broadcast: 2)
2023-04-10 10:22:58.943 (   0.000s) [           2E187]      netinterfaces.cpp:91    INFO| netif 'anpi0' (status: 32768, multicast: 1, broadcast: 2)
2023-04-10 10:22:58.943 (   0.000s) [           2E187]      netinterfaces.cpp:105   INFO| 	IPv6 addr: fe80::a077:33ff:feb6:d59e%anpi0
2023-04-10 10:22:58.943 (   0.000s) [           2E187]      netinterfaces.cpp:91    INFO| netif 'anpi2' (status: 32768, multicast: 1, broadcast: 2)
2023-04-10 10:22:58.943 (   0.000s) [           2E187]      netinterfaces.cpp:91    INFO| netif 'anpi2' (status: 32768, multicast: 1, broadcast: 2)
2023-04-10 10:22:58.943 (   0.000s) [           2E187]      netinterfaces.cpp:105   INFO| 	IPv6 addr: fe80::a077:33ff:feb6:d5a0%anpi2
2023-04-10 10:22:58.943 (   0.000s) [           2E187]      netinterfaces.cpp:91    INFO| netif 'anpi1' (status: 32768, multicast: 1, broadcast: 2)
2023-04-10 10:22:58.943 (   0.000s) [           2E187]      netinterfaces.cpp:91    INFO| netif 'anpi1' (status: 32768, multicast: 1, broadcast: 2)
2023-04-10 10:22:58.943 (   0.000s) [           2E187]      netinterfaces.cpp:105   INFO| 	IPv6 addr: fe80::a077:33ff:feb6:d59f%anpi1
2023-04-10 10:22:58.943 (   0.000s) [           2E187]      netinterfaces.cpp:91    INFO| netif 'en4' (status: 32768, multicast: 1, broadcast: 2)
2023-04-10 10:22:58.943 (   0.000s) [           2E187]      netinterfaces.cpp:91    INFO| netif 'en5' (status: 32768, multicast: 1, broadcast: 2)
2023-04-10 10:22:58.943 (   0.000s) [           2E187]      netinterfaces.cpp:91    INFO| netif 'en6' (status: 32768, multicast: 1, broadcast: 2)
2023-04-10 10:22:58.943 (   0.000s) [           2E187]      netinterfaces.cpp:91    INFO| netif 'en1' (status: 32768, multicast: 1, broadcast: 2)
2023-04-10 10:22:58.943 (   0.000s) [           2E187]      netinterfaces.cpp:91    INFO| netif 'en2' (status: 32768, multicast: 1, broadcast: 2)
2023-04-10 10:22:58.943 (   0.000s) [           2E187]      netinterfaces.cpp:91    INFO| netif 'en3' (status: 32768, multicast: 1, broadcast: 2)
2023-04-10 10:22:58.943 (   0.000s) [           2E187]      netinterfaces.cpp:91    INFO| netif 'bridge0' (status: 32768, multicast: 1, broadcast: 2)
2023-04-10 10:22:58.943 (   0.000s) [           2E187]      netinterfaces.cpp:91    INFO| netif 'ap1' (status: 32768, multicast: 0, broadcast: 2)
2023-04-10 10:22:58.943 (   0.000s) [           2E187]      netinterfaces.cpp:91    INFO| netif 'en0' (status: 32768, multicast: 1, broadcast: 2)
2023-04-10 10:22:58.943 (   0.000s) [           2E187]      netinterfaces.cpp:91    INFO| netif 'en0' (status: 32768, multicast: 1, broadcast: 2)
2023-04-10 10:22:58.943 (   0.000s) [           2E187]      netinterfaces.cpp:105   INFO| 	IPv6 addr: fe80::1490:8080:54a8:15f9%en0
2023-04-10 10:22:58.943 (   0.000s) [           2E187]      netinterfaces.cpp:91    INFO| netif 'en0' (status: 32768, multicast: 1, broadcast: 2)
2023-04-10 10:22:58.943 (   0.000s) [           2E187]      netinterfaces.cpp:102   INFO| 	IPv4 addr: a081e54
2023-04-10 10:22:58.943 (   0.000s) [           2E187]      netinterfaces.cpp:91    INFO| netif 'awdl0' (status: 32768, multicast: 1, broadcast: 2)
2023-04-10 10:22:58.943 (   0.000s) [           2E187]      netinterfaces.cpp:91    INFO| netif 'awdl0' (status: 32768, multicast: 1, broadcast: 2)
2023-04-10 10:22:58.943 (   0.000s) [           2E187]      netinterfaces.cpp:105   INFO| 	IPv6 addr: fe80::905e:3eff:fec5:e8f2%awdl0
2023-04-10 10:22:58.943 (   0.000s) [           2E187]      netinterfaces.cpp:91    INFO| netif 'llw0' (status: 32768, multicast: 1, broadcast: 2)
2023-04-10 10:22:58.943 (   0.000s) [           2E187]      netinterfaces.cpp:91    INFO| netif 'llw0' (status: 32768, multicast: 1, broadcast: 2)
2023-04-10 10:22:58.943 (   0.000s) [           2E187]      netinterfaces.cpp:105   INFO| 	IPv6 addr: fe80::905e:3eff:fec5:e8f2%llw0
2023-04-10 10:22:58.943 (   0.000s) [           2E187]      netinterfaces.cpp:91    INFO| netif 'utun0' (status: 32768, multicast: 1, broadcast: 0)
2023-04-10 10:22:58.943 (   0.000s) [           2E187]      netinterfaces.cpp:91    INFO| netif 'utun0' (status: 32768, multicast: 1, broadcast: 0)
2023-04-10 10:22:58.943 (   0.000s) [           2E187]      netinterfaces.cpp:105   INFO| 	IPv6 addr: fe80::ad6e:4302:db69:932a%utun0
2023-04-10 10:22:58.943 (   0.000s) [           2E187]      netinterfaces.cpp:91    INFO| netif 'utun1' (status: 32768, multicast: 1, broadcast: 0)
2023-04-10 10:22:58.943 (   0.000s) [           2E187]      netinterfaces.cpp:91    INFO| netif 'utun1' (status: 32768, multicast: 1, broadcast: 0)
2023-04-10 10:22:58.943 (   0.000s) [           2E187]      netinterfaces.cpp:105   INFO| 	IPv6 addr: fe80::9892:4496:3c65:2df8%utun1
2023-04-10 10:22:58.943 (   0.000s) [           2E187]      netinterfaces.cpp:91    INFO| netif 'utun2' (status: 32768, multicast: 1, broadcast: 0)
2023-04-10 10:22:58.943 (   0.000s) [           2E187]      netinterfaces.cpp:91    INFO| netif 'utun2' (status: 32768, multicast: 1, broadcast: 0)
2023-04-10 10:22:58.943 (   0.000s) [           2E187]      netinterfaces.cpp:105   INFO| 	IPv6 addr: fe80::ce81:b1c:bd2c:69e%utun2
2023-04-10 10:22:58.943 (   0.000s) [           2E187]      netinterfaces.cpp:91    INFO| netif 'utun3' (status: 32768, multicast: 1, broadcast: 0)
2023-04-10 10:22:58.943 (   0.000s) [           2E187]      netinterfaces.cpp:91    INFO| netif 'utun3' (status: 32768, multicast: 1, broadcast: 0)
2023-04-10 10:22:58.943 (   0.000s) [           2E187]      netinterfaces.cpp:105   INFO| 	IPv6 addr: fe80::ed71:6592:4dbd:9c47%utun3
2023-04-10 10:22:58.943 (   0.000s) [           2E187]      netinterfaces.cpp:91    INFO| netif 'utun4' (status: 32768, multicast: 1, broadcast: 0)
2023-04-10 10:22:58.943 (   0.000s) [           2E187]      netinterfaces.cpp:91    INFO| netif 'utun4' (status: 32768, multicast: 1, broadcast: 0)
2023-04-10 10:22:58.943 (   0.000s) [           2E187]      netinterfaces.cpp:105   INFO| 	IPv6 addr: fe80::f58c:6082:9735:f3f6%utun4
2023-04-10 10:22:58.943 (   0.000s) [           2E187]         api_config.cpp:270   INFO| Loaded default config
2023-04-10 10:22:58.945 (   0.003s) [           2E187]             common.cpp:65    INFO| git:v1.16.1-2-gb2f865a9/branch:master/build:Release/compiler:AppleClang-14.0.3.14030022/link:SHARED
2023-04-10 10:22:58.946 (   0.003s) [           2E187]         udp_server.cpp:82    WARN| Could not bind multicast responder for ff02:113d:6fdd:2c17:a643:ffe2:1bd1:3cd2 to interface ::1 (Can't assign requested address)
2023-04-10 10:22:58.946 (   0.003s) [           2E187]         udp_server.cpp:82    WARN| Could not bind multicast responder for ff05:113d:6fdd:2c17:a643:ffe2:1bd1:3cd2 to interface ::1 (Can't assign requested address)
Sending sample 0 on myuid34234, have_consumers=False
2023-04-10 10:22:59.252 (   1.037s) [           2E177]             common.cpp:65    INFO| git:v1.16.1-2-gb2f865a9/branch:master/build:Release/compiler:AppleClang-14.0.3.14030022/link:SHARED
Sending sample 600 on myuid34234, have_consumers=True
Sending sample 1200 on myuid34234, have_consumers=True
Sending sample 1800 on myuid34234, have_consumers=True
Sending sample 2400 on myuid34234, have_consumers=True
Sending sample 3000 on myuid34234, have_consumers=True
Sending sample 3600 on myuid34234, have_consumers=True
Sending sample 4200 on myuid34234, have_consumers=True
Sending sample 4800 on myuid34234, have_consumers=True
Sending sample 5400 on myuid34234, have_consumers=True
Sending sample 6000 on myuid34234, have_consumers=True
Sending sample 6600 on myuid34234, have_consumers=True
Sending sample 7200 on myuid34234, have_consumers=True
Sending sample 7800 on myuid34234, have_consumers=True
Sending sample 8400 on myuid34234, have_consumers=True
Sending sample 9000 on myuid34234, have_consumers=True
Sending sample 9600 on myuid34234, have_consumers=True
Sending sample 10200 on myuid34234, have_consumers=True
Sending sample 10800 on myuid34234, have_consumers=True
Sending sample 11400 on myuid34234, have_consumers=True
Sending sample 12000 on myuid34234, have_consumers=True
Sending sample 12600 on myuid34234, have_consumers=True
Sending sample 13200 on myuid34234, have_consumers=True
Process Process-1:
Traceback (most recent call last):
  File "/Users/charles/mambaforge/envs/mne-realtime/lib/python3.11/multiprocessing/process.py", line 314, in _bootstrap
    self.run()
  File "/Users/charles/mambaforge/envs/mne-realtime/lib/python3.11/multiprocessing/process.py", line 108, in run
    self._target(*self._args, **self._kwargs)
  File "/Users/charles/Development/mne-realtime/mne_realtime/mock_lsl_stream.py", line 99, in _initiate_stream
    outlet.push_sample(mysample)
  File "/Users/charles/mambaforge/envs/mne-realtime/lib/python3.11/site-packages/pylsl/pylsl.py", line 454, in push_sample
    raise ValueError("length of the sample (" + str(len(x)) + ") must "
ValueError: length of the sample (0) must correspond to the stream's channel count (60).
2023-04-10 10:23:21.948 (  23.733s) [R_MNE           ]      data_receiver.cpp:342    ERR| Stream transmission broke off (Input stream error.); re-connecting...

(And then the test freezes and requires a KeyboardInterrupt to finish).

FYI in case it matters, I am running on macOS.

@larsoner
Copy link
Member

After fixing the n_samples int issue, the test continues much further but eventually freezes on something and requires a Ctrl-C to exit it. I'm not quite sure what the issue is. Have you seen this before?

Sounds like it's sending more data than we need. In theory you should be able to tell it to mock a shorter file or set some timeout in a MNE-Realtime object to get it to timeout or something. See if there's anything like that, and if not I'll take a look. Really it shouldn't be your problem to have to fix so don't feel obligated to spend too much time on it...

@LarsonR
Copy link

LarsonR commented Apr 10, 2023

@charlesincharge You want @larsoner not me

@charlesbmi
Copy link
Contributor Author

ah, sorry about that!

…nfinite generator, so it is not possible to convert to a list
@charlesbmi
Copy link
Contributor Author

charlesbmi commented Apr 10, 2023

e439219 should fix this error:

Traceback (most recent call last):
  File "/Users/charles/mambaforge/envs/mne-realtime/lib/python3.11/multiprocessing/process.py", line 314, in _bootstrap
    self.run()
  File "/Users/charles/mambaforge/envs/mne-realtime/lib/python3.11/multiprocessing/process.py", line 108, in run
    self._target(*self._args, **self._kwargs)
  File "/Users/charles/Development/mne-realtime/mne_realtime/mock_lsl_stream.py", line 99, in _initiate_stream
    outlet.push_sample(mysample)
  File "/Users/charles/mambaforge/envs/mne-realtime/lib/python3.11/site-packages/pylsl/pylsl.py", line 454, in push_sample
    raise ValueError("length of the sample (" + str(len(x)) + ") must "
ValueError: length of the sample (0) must correspond to the stream's channel count (60).

And then the test was subsequently froze on list(client.iter_raw_buffers()); this should be fixed by 990f7a2

Copy link
Member

@larsoner larsoner left a comment

Choose a reason for hiding this comment

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

Looks great, marking for merge when green. Thanks in advance @charlesincharge !

@larsoner larsoner enabled auto-merge (squash) April 11, 2023 16:47
@larsoner larsoner merged commit 73edc95 into mne-tools:main Apr 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants