Starts a remote JupyterLab server to allow the user to connect to the codespace via JupyterLab in their browser
(ctx context.Context)
| 166 | |
| 167 | // Starts a remote JupyterLab server to allow the user to connect to the codespace via JupyterLab in their browser |
| 168 | func (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 |
| 191 | func (i *invoker) RebuildContainer(ctx context.Context, full bool) error { |
nothing calls this directly
no test coverage detected