Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -117,13 +117,13 @@ jobs:
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
with:
name: test-results-${{ matrix.os }}-${{ matrix.python-version }}
path: '**/junit.xml'
path: junit.xml
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.11'

- name: Publish Unit Test Results
uses: EnricoMi/publish-unit-test-result-action@d0a4676d0e0b938bc201470d88276b7c74c712b3 # v2.24.0
with:
files: '**/junit.xml'
files: junit.xml
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.11'

- name: Upload coverage
Expand Down
333 changes: 325 additions & 8 deletions csp_gateway/client/client.py

Large diffs are not rendered by default.

26 changes: 23 additions & 3 deletions csp_gateway/server/demo/omnibus.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
MountPerspectiveTables,
MountRestRoutes,
MountWebSocketRoutes,
Stage,
State,
)
from csp_gateway.server.config import load_gateway
Expand Down Expand Up @@ -115,11 +116,21 @@ class ExampleGatewayChannels(GatewayChannels):
example_list: ts[List[ExampleData]] = None
never_ticks: ts[ExampleData] = None

s_example: ts[State[ExampleData]] = None
# State fields can be added via annotation or the `set_state` API in the module's `connect` method
example_with_state: Annotated[ts[ExampleData], State(("id", "x"))] = None
example_with_state_multiple: Annotated[
ts[ExampleData],
State(("id", "x")),
State(("id", "y"), alias="example_with_state_alternative"),
] = None
# example: Set in connect with a different schema, to show flexibility of state definition

basket: Dict[ExampleEnum, ts[ExampleData]] = None
str_basket: Dict[str, ts[ExampleData]] = None

# Staging can be added via annotation or the `set_stage` API in the module's `connect` method
example_with_stage: Annotated[ts[ExampleData], Stage()] = None

# FIXME
# basket_list: Dict[ExampleEnum, ts[[ExampleData]]] = None
# NOTE: this second one is not populated with data so will 404
Expand Down Expand Up @@ -179,6 +190,9 @@ def connect(self, channels: ExampleGatewayChannels):
# Channels set via `set_channel`
channels.set_channel(ExampleGatewayChannels.example, data)
channels.set_channel(ExampleGatewayChannels.example_list, data_list)
channels.set_channel(ExampleGatewayChannels.example_with_state, data)
channels.set_channel(ExampleGatewayChannels.example_with_state_multiple, data)
channels.set_channel(ExampleGatewayChannels.example_with_stage, data)

# Generic channel for sending data from non-csp sources
channels.add_send_channel(ExampleGatewayChannels.example)
Expand All @@ -187,8 +201,14 @@ def connect(self, channels: ExampleGatewayChannels):
channels.add_send_channel(ExampleGatewayChannels.basket, ExampleEnum.C)
channels.add_send_channel(ExampleGatewayChannels.basket)

# Rudimentary state accumulation via `set_state`
channels.set_state(ExampleGatewayChannels.example, "id")
# State accumulation via `set_state`
channels.set_state(
ExampleGatewayChannels.example,
("id",),
)

# Staging via `set_stage` — enables stage_add/remove/release/list/lookup APIs
channels.set_stage(ExampleGatewayChannels.example)

# Create some data streams for dict baskets
data_a = self.subscribe(
Expand Down
1 change: 1 addition & 0 deletions csp_gateway/server/gateway/csp/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@
on_request_node_dict_basket,
)
from .module import Module
from .stage import *
from .state import *
Loading
Loading