Conversation
|
Notes on schema: register ( hset:
upload (
|
171304f to
ed9f470
Compare
|
Start server, with optional Connect with the Python client, and create an array. c = from_uri('http://localhost:8000', api_key='secret')
x = c.write_array([1,2,3], key='x')Subscribe for updates on this array. Back in the Python client, alter (overwrite, in this case) the array. x.write(np.array([4,5,7]))Websocket gets an update! Above we get JSON but msgpack can be requested: A whole lot is missing—too much to bother enumerating here—but this shows the basic pieces communicating. |
|
Couple of considerations to make for the /stream/stop endpoint
|
|
Agreed. We added a column to the nodes table which I think is the right out-of-band encoded to address these questions. That will also facilitate (in a future PR...) search queries like, "List the nodes that are streaming." |
2e58c0c to
e8b41d0
Compare
|
TO DO:
|
c4dba72 to
f5c8d9b
Compare
|
A heartbeat for @kivel: We have removed "redis" from public APIs. The next step toward generalization would be some polymorphic adapter ("adapter" in the general sense, not a "Tiled Adapter") that will enable a common interface to Redis-backed and NATS-backed (etc.) implementations. That might happen in a later PR, but the track is laid. |
|
Skipping these tests on Windows, for now, would be acceptable IMO. |
tiled/_tests/test_websockets.py
Outdated
| yield context | ||
|
|
||
|
|
||
| @pytest.mark.skipif(sys.platform == "win32", reason="Requires Redis service") |
There was a problem hiding this comment.
This can be done at the module level, I believe. Less work for Future Us when we add more tests or if we add Windows support.
1cfb43c to
b3b7110
Compare
b3b7110 to
95d368a
Compare
| args: | ||
| uri: "catalog.db" | ||
| ``` | ||
| redis: |
There was a problem hiding this comment.
| redis: | |
| cache: |
There was a problem hiding this comment.
Is this config respected? I suspect it might be ignored because I don't see any changes in tiled.config that would parse it and pass it along into the settings.
There was a problem hiding this comment.
I fixed up this file. But it looks like this file is just for validating config files not something that gets loaded into settings?
|
The low coverage number comes in large from some misconfiguration. Merging now, with a fix for that to follow, to hit our pre-announced outage window. |
* Added endpoint to router * Refactored get_entry() to not use dependencies * Formatting * get_entry only returns an entry * Refactored get_current_principal for websockets * Initial websocket endpoint implementation * Added: - config schema def for redis client - CLI - redis client * Added: - redis client init - Removed client config from service config schema * chore: stripping trailing whitespace * chore: black formatting * Added redis_client to CatalogAdapter * Refactored deserialization * Connect with websockets * Fixed get_entry() calls to match signature * Added code to push data to redis * Satisfy linter * redis must be optional * Missing API should return 401 (not 500) * Do not decode the payload. * Handle msgpack and JSON serialization correctly. * Fix exit logic? * Added stop stream endpoint * Changed post /stream/close to a delete verb * Closing stream should be idempotent * Set seq_num:node_id to expire when stream is closed * Satisfy linters * Namespace /stream to /stream/single * Remove vestigial parameter. * Closing works and updates database. * Add search on is_streaming. * Expose DELETE /stream/close in client. * Use py39-compat usage. * Validate input for envelope_format * Decode *after* streaming, and give more metadata * Implement streaming for write_block * Implement streaming for PATCH array * Clean up errors on put_data_source codepath. * No mimetype for data_source * Handle data_source or payload * Use out-of-band signaling. * Separated websocket handling and redis interaction * Default content-type for arrays * Support streaming container, composite. * Move data_source into metadata. Close explicitly. * Rename ?seq_num to ?start and include sequence in metadata. * Add client Subscription object based on caproto. * Refine Subscription API * Renamed encoder to envelope_formatter for consistency * Bug fixes and variable name clarification * Fix ws/wss conditional * Handle weakrefs correctly * Revoke API key after use. * Add types and docstring to Subscription. * Added more metadata * Changed order of metadata * Added patch * Fix Patch scheme: tuple of multiple ints * Added uri of slices to stream * checking if i can commit * update pyproject from rebase * is_streaming migration * update test_write_array_internal_direct * Changed command line flag --redis to --cache * add test_websockets * trying to get the TestClient to connect to websocket * touch up root_tree * websocket test touch up * use context manager for TestClient * the test is working finally * touch ups websocket test * make a tiled_websocket_context fixture * add the rest of the tests from test-redis-ws * last test is hanging waiting for historical message * basic websocket tests passing * add redis for ci * skip websocket tests on windows * skip the whole module on win * test Subscription, need a better way to close the thread in _receive * test_subscription is passing * add WebSocketWrapper * tests working with wrapper * add more tests from Subscription * add socket_timeout and socket_connect_timeout cache_settings * test the close endpoint * I think there is a minor problem with the close endpoint * first pass at adding locust websocket tests * change cache_ttl to integer from float * update the websocket header to include 'Apikey', close endpoint returns 404 if node doesn't exist or is already closed * update Subscription header to be prefixed by Apikey * locust streaming tests are working, but only in headless mode * update locust readme * Fix zarr declaration * remove SpecialUser * update websocket wrapper classes * Add redis dep for pixi too * The websockets library is a client-side dep. * Fix mistake introduced in rebase * Missed purge of 'composite' in rebase * Disambiguate between single-user and anonymous * rebase mistake * more tests are passing * websocket tests all passing * remove is_streaming * update adapter streaming logic to use redis * add auth tests * clear state between subcription tests * Apply move API key to HTTP (not WS) requests. * fixes based on dans comments * load cache settings from config file * fix duplicate config key name * Parse streaming_cache from config. * add cache_settings to in_memory * Supply TILED_TEST_REDIS explicitly. Remove randomness. * Address pydantic deprecation warning on dict() * Remove TODO; this looks good * The referenced issues has been closed, types are tightened * Disable LDAP tests for now #1109 * Properly detect request scopes and access_tags. * Drop commented-out vestigial parameters. * Properly integrate access tags, scopes with WS endpoint --------- Co-authored-by: Dan Allan <dallan@bnl.gov> Co-authored-by: gbischof <bisc8233@gmail.com>
Checklist