MCPcopy Create free account
hub / github.com/cli/cli / StartJupyterServer

Method StartJupyterServer

internal/codespaces/rpc/invoker.go:168–188  ·  view source on GitHub ↗

Starts a remote JupyterLab server to allow the user to connect to the codespace via JupyterLab in their browser

(ctx context.Context)

Source from the content-addressed store, hash-verified

166
167// Starts a remote JupyterLab server to allow the user to connect to the codespace via JupyterLab in their browser
168func (i *invoker) StartJupyterServer(ctx context.Context) (port int, serverUrl string, err error) {
169 ctx = i.appendMetadata(ctx)
170 ctx, cancel := context.WithTimeout(ctx, requestTimeout)
171 defer cancel()
172
173 response, err := i.jupyterClient.GetRunningServer(ctx, &jupyter.GetRunningServerRequest{})
174 if err != nil {
175 return 0, "", fmt.Errorf("failed to invoke JupyterLab RPC: %w", err)
176 }
177
178 if !response.Result {
179 return 0, "", fmt.Errorf("failed to start JupyterLab: %s", response.Message)
180 }
181
182 port, err = strconv.Atoi(response.Port)
183 if err != nil {
184 return 0, "", fmt.Errorf("failed to parse JupyterLab port: %w", err)
185 }
186
187 return port, response.ServerUrl, err
188}
189
190// Rebuilds the container using cached layers by default or from scratch if full is true
191func (i *invoker) RebuildContainer(ctx context.Context, full bool) error {

Callers

nothing calls this directly

Calls 3

appendMetadataMethod · 0.95
GetRunningServerMethod · 0.65
ErrorfMethod · 0.65

Tested by

no test coverage detected