-
Notifications
You must be signed in to change notification settings - Fork 680
Open
Labels
sdk-pythonPython logging APIPython logging API
Description
In the Python SDK, the only way to spawn an internal grpc_server is using the .serve_grpc() APIs.
The grpc server is stored in a LogSink and is automatically cleaned up if the corresponding recording goes out of scope or is disconnected.
This leads to confusing situations like the following:
import rerun as rr
rr.init("rerun_example_grpc_server")
# Create a grpc server
uri = rr.serve_grpc()
# A user might want to connect to it with a dedicated stream
rec1 = rr.RecordingStream("rerun_example_grpc_server")
rec1.connect_grpc(uri)
rec1.log("object_stream", rr.TextLog("This works"))
# Later they set up the global recording to go to file isntead
rr.save("rerun_example_grpc_server.rerun")
# Doing the same thing, now fail because the grpc server was implicitly shut down
# when the global recording was switched to a file sin
rec2 = rr.RecordingStream("rerun_example_grpc_server")
rec2.connect_grpc(uri)
rec2.log("object_stream", rr.TextLog("This fail"))It would be nice if a dedicated server object was created, separate of the stream concepts:
import rerun as rr
# Create a grpc server. As long as the server object exists
server = rr.GrpcServer()
# A user can then connect to the server with a stream
rec1 = rr.RecordingStream("rerun_example_grpc_server")
rec1.connect_grpc(server)
rec1.log("object_stream", rr.TextLog("This works"))
# Changes to the global stream have no implicit impact on the server object
rr.save("rerun_example_grpc_server.rerun")
# A user can still connect and log to the server
rec2 = rr.RecordingStream("rerun_example_grpc_server")
rec2.connect_grpc(server)
rec2.log("object_stream", rr.TextLog("This still works"))Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
sdk-pythonPython logging APIPython logging API