Skip to content
This repository has been archived by the owner on Feb 8, 2024. It is now read-only.

defer binder connection #2132

Merged
merged 2 commits into from
Jun 21, 2023
Merged

defer binder connection #2132

merged 2 commits into from
Jun 21, 2023

Conversation

vabarbosa
Copy link
Contributor

@vabarbosa vabarbosa commented Jun 21, 2023

Changes

this is a first step in alleviating the load on mybinder. additional investigation is underway to further minimize the load and also find alternative solutions.

previously whenever a page loaded, the application would connect to mybinder, execute some init code, then wait for user to run the code cells. this results in a lot of connections and code executions in mybinder given all the times users visit a page and do not try to run any code cells.

this PR modifies the behavior and defers the connection to mybinder until the user has actually tried to execute one of the code cells. unfortunately, this may mean a longer wait when a user is first executing a code cell but that trade-off is acceptable in the immediate term.

related #751

Preview Link

Implementation details

  • remove the initializing of mybinder and running of init code from the CodeOutput's mounted() lifecycle
  • when user run a code cell
    • check if kernel is available
    • if kernel does not exist, initialize mybinder and run init code then run the code cell
    • if kernel already exists just run the code cell
  • update the label of the run to Start kernel and run if no kernel is detected, else keep as Run

How to read this PR

  • review changes to logic for initialize kernel in CodeOutput
  • review changes to code cell buttons behavior and labeling in ExerciseActionsBar
  • review changes to how CodeExercise and Scratchpad interact with updated CodeOutput and ExerciseActionsBar
  • visit the preview link and navigate to different pages verifying mybinder is not initialized until you run a code cell

Screenshots

Screen.Recording.2023-06-21.at.00.59.21.mov

Copy link
Member

@abdonrd abdonrd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thanks @vabarbosa! 👏

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
No open projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants