-
-
Notifications
You must be signed in to change notification settings - Fork 159
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
Make Cyberbrain more intuitive to use #55
Labels
Comments
laike9m
changed the title
Improve client/server communication mechanism
Make Cyberbrain more intuitive to use
Oct 18, 2020
@alexmojaki @cool-RR @laixintao to take a look |
Sounds like a good plan. |
laike9m
added a commit
that referenced
this issue
Nov 10, 2020
laike9m
added a commit
that referenced
this issue
Nov 10, 2020
The re-implementation of current user workflow (single frame) is done and released in 0.0.10. I will create separate issues for multi-frame support. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Background
In #49 and cool-RR's email, an issue was mentioned:
It is not intuitive how to run a different program and open the trace graph with new data.
Quote:
Clearly we need to do better at this.
How It Works Now?
Currently, the Cyberbrain Python lib (abbr. cb-py) launches a server. When users run "Initialize Cyberbrain" in VS Code, the The Cyberbrain VS Code extension (abbr. cb-vsc) talks to the server and fetches data, then visualizes it. The server listens on a fixed port, thus there can't be multiple running servers.
Proposed Solution
Note: the below solution takes into consideration a feature which has not been implemented yet: multi-frame tracing. The original design of this feature is described here, which may differ from the below solution. But the core idea keeps unchanged: let users pick the frame to visualize.
Overview
cb-vsc automatically starts a long-running server, let's call it coordination server (abbr. cs). The workflow looks like this:
cb-py sends this frame to cs/cb-vsc, cb-vsc generates a new trace graph.
3. cb-py sends the locations of these frames (aka
FrameLocaterList
) to cs/cb-vsc4. The user picks one frame (details TBD), cs/cb-vsc sends the location of this frame (
FrameLocater
) back to cb-py5. cb-py sends the selected frame to cs/cb-vsc, cb-vsc generates a new trace graph.
Note that in case 2.2, step 3-5 could repeat multiple times to allow visualizing different frames in the same execution. This requires server-side streaming RPC, so cs/cb-vsc can send multiple
FrameLocater
s to cb-py. Also cb-vsc should persist the locations of all available frames.The proposed solution has a few benefits compared to the existing implementation:
The Coordination Server
Requirements:
cs should remain active as long as VS Code is open, presumably with a periodic status check.
The listening port should be configurable. Potentially, we can use a config file
~/.cyberbrain_config
and let cb-py and cb-vsc read it.Open questions:
Things to Take into Consideration
Stateless
The infrastructure should be as stateless as possible, otherwise it would be very complicated to maintain and extend.
Future Proof
The design should work well with future features to add, including (but not limited to) multi-frame tracing, though this is hard since things may change or news features are planned.
Needs to work well with codelens #34
The report sent from cb-py could potentially carry information to tell cb-vsc where to show codelens, so that users are aware of the click-to-enable-trace-graph feature. This (and supporting for multi-frame tracing) also means that the Python program needs to stay alive before manually terminated.
Remote Debugging Friendly
The design should be able to support remote debugging.
AI: Learn how remote debugging works.
Third-party Friendly
We should not rely on VS Code specific things, and if users want to build their own cs and frontend, they should be able to do so.
The text was updated successfully, but these errors were encountered: