Skip to content

Add dedicated serve_web_viewer function #9469

Closed
@emilk

Description

@emilk

We have two function for serving data in our SDK:

serve_grpc starts a gRPC server and uses it as a log sink. Makes sense.

serve_web also starts a gRPC server AND a web server. This makes less sense.

I suggest we go with one of these alternatives instead:

❌ Integrate serve_web into serve_grpc

rr.serve_grpc() # Only starts the gRPC server

rr.serve_grpc(host_web_viewer=True) # Also hosts the web viewer

# Also opens a browser with the web viewer, connected to the gRPC server
rr.serve_grpc(host_web_viewer=True, open_browser=True)

PRO:

  • one single function
  • always a log sink
  • can't host a web viewer without a gRPC server

CON:

  • can't host a web viewer without a gRPC server
  • one function, two features

✅ Replace serve_web with serve_web_viewerWe're going with this one!

Separate function for orthogonal things:

grpc_uri = rr.serve_grpc() # Hosts the gRPC server
rr.serve_web_viewer(connect_to=grpc_uri) # Hosts a web viewer

PRO:

  • two functions for two features
  • you can access all four quadrants of the cartesian feature product

CON:

  • there is little value in just hosting a web viewer without a gRPC server
  • confusingly, serve_grpc is a log sink but serve_web_viewer is not
  • open_browser param would probably have to go, or blindly guess on the gRPC ip/port.

❌ Integrate both functions into a common serve function

rr.serve(grpc=True) # Only host gRPC server
rr.serve(viewer=True) # Only host web viewer
rr.serve(grpc=True, viewer=True) # Host both
rr.serve() # Error: must choose at least one thing to serve

PRO:

  • one single function, with a clear name
  • you can access all four quadrants of the cartesian feature product

CON:

  • its only a sink of grpc=True
  • one function for two features
  • there is little value in just hosting a web viewer without a gRPC server

I think any of these alternatives will be less confusing to our users, but I think the first alternative is probably the best.

In either case, we keep the old serve_web (and even older serve), but deprecated.

Metadata

Metadata

Assignees

Labels

😤 annoyingSomething in the UI / SDK is annoying to use🪵 Log & send APIsAffects the user-facing API for all languages

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions