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

[dagster webserver] fix websockets on py3.11 #19328

Merged
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ async def graphql_ws_endpoint(self, websocket: WebSocket):
"""
tasks: Dict[str, Task] = {}

await websocket.accept(subprotocol=GraphQLWS.PROTOCOL)
await websocket.accept(subprotocol=GraphQLWS.PROTOCOL.value)

try:
while (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import gc
import sys
from contextlib import contextmanager
from typing import Iterator
from unittest import mock

import objgraph
Expand Down Expand Up @@ -36,7 +37,7 @@


@contextmanager
def create_asgi_client(instance):
def create_asgi_client(instance) -> Iterator[TestClient]:
yaml_paths = [file_relative_path(__file__, "./workspace.yaml")]

with WorkspaceProcessContext(
Expand Down Expand Up @@ -82,14 +83,15 @@ def example_job():
example_op()


def test_event_log_subscription():
def test_event_log_subscription() -> None:
with instance_for_test() as instance:
run = example_job.execute_in_process(instance=instance)
assert run.success
assert run.run_id

with create_asgi_client(instance) as client:
with client.websocket_connect("/graphql", GraphQLWS.PROTOCOL) as ws:
assert str(ws.accepted_subprotocol) == "graphql-ws"
start_subscription(ws, EVENT_LOG_SUBSCRIPTION, {"runId": run.run_id})
gc.collect()
assert len(objgraph.by_type("async_generator")) == 1
Expand Down