Skip to content
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

Connect refactor #4

Open
wants to merge 22 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
21c62b2
move reusable grpc components into a base class
hotpocket Dec 5, 2024
1000516
Add ConnectSerializer and the code to select and run it. Refactor ker…
hotpocket Dec 5, 2024
c616b3c
handle error on missing tls similar to kernelServer. Add missing call…
hotpocket Dec 6, 2024
ea26204
add missing config block
hotpocket Dec 6, 2024
a302049
creating the maskedNotebook using `new` causes cells to be copied by …
hotpocket Dec 12, 2024
a9b0554
Merge branch 'main' into connect-refactor
hotpocket Dec 12, 2024
68ea437
getOutputsUri no longer resides on GrpcSerializer and thus broke this…
hotpocket Dec 12, 2024
49fe3a7
replace GrpcSerializer with ConnectSerializer and fix types as needed.
hotpocket Dec 12, 2024
827354a
client init in serializer.ts now calls `getTLSEnabled()` which needs`…
hotpocket Dec 12, 2024
052b70f
i have no idea what's going on here but this makes it work.
hotpocket Dec 12, 2024
10c9c8e
Merge branch 'main' into connect-refactor
hotpocket Dec 13, 2024
70fc30d
fix struct and data items that differ in new implementation.
hotpocket Dec 13, 2024
af02abc
fix typo
hotpocket Dec 13, 2024
81c8c03
fix invalid proto prop reference
hotpocket Dec 15, 2024
14b0f52
combine grpc base and grpc serializer. reorder changes to minimize PR…
hotpocket Dec 15, 2024
99964a2
more diff consolidation for PR
hotpocket Dec 15, 2024
f9f3e1b
pr diff cleanup
hotpocket Dec 17, 2024
f1e08e3
Merge branch 'main' into connect-refactor
hotpocket Dec 18, 2024
e4c2507
fix old schema via foyle npm update
hotpocket Dec 20, 2024
64f5b2b
Merge branch 'main' into connect-refactor
hotpocket Dec 20, 2024
1aa7dfe
expose TLS methods to avoid code duplication
hotpocket Dec 20, 2024
f9144e2
remove stale comment
hotpocket Dec 20, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 18 additions & 5 deletions src/extension/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,13 @@ import {
runForkCommand,
selectEnvironment,
} from './commands'
import { WasmSerializer, GrpcSerializer, SerializerBase } from './serializer'
import {
WasmSerializer,
GrpcSerializer,
SerializerBase,
ConnectSerializer,
GrpcSerializerBase,
} from './serializer'
import { RunmeLauncherProvider, RunmeTreeProvider } from './provider/launcher'
import { RunmeLauncherProvider as RunmeLauncherProviderBeta } from './provider/launcherBeta'
import { RunmeUriHandler } from './handler/uri'
Expand Down Expand Up @@ -104,6 +110,8 @@ export class RunmeExtension {
const grpcSerializer = kernel.hasExperimentEnabled('grpcSerializer')
const grpcServer = kernel.hasExperimentEnabled('grpcServer')
const grpcRunner = kernel.hasExperimentEnabled('grpcRunner')
const config = workspace.getConfiguration('runme')
const serializerAddress = config.get<string>('serializerAddress')

const server = new KernelServer(
context.extensionUri,
Expand All @@ -128,11 +136,16 @@ export class RunmeExtension {
)

const reporter = new GrpcReporter(context, server)
const serializer = grpcSerializer
? new GrpcSerializer(context, server, kernel)
: new WasmSerializer(context, kernel)
let serializer: SerializerBase
if (serializerAddress && serializerAddress.length > 0) {
serializer = new ConnectSerializer(context, serializerAddress, kernel)
} else if (grpcSerializer) {
serializer = new GrpcSerializer(context, server, kernel)
} else {
serializer = new WasmSerializer(context, kernel)
}
this.serializer = serializer
kernel.setSerializer(serializer as GrpcSerializer)
kernel.setSerializer(serializer as GrpcSerializerBase)
kernel.setReporter(reporter)

let treeViewer: RunmeTreeProvider
Expand Down
10 changes: 5 additions & 5 deletions src/extension/kernel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ import { handleCellOutputMessage } from './messages/cellOutput'
import handleGitHubMessage, { handleGistMessage } from './messages/github'
import { getNotebookCategories } from './utils'
import PanelManager from './panels/panelManager'
import { GrpcSerializer, SerializerBase } from './serializer'
import { GrpcSerializerBase } from './serializer'
import { askAlternativeOutputsAction, openSplitViewAsMarkdownText } from './commands'
import { handlePlatformApiMessage } from './messages/platformRequest'
import { handleGCPMessage } from './messages/gcp'
Expand Down Expand Up @@ -148,7 +148,7 @@ export class Kernel implements Disposable {
protected activeTerminals: ActiveTerminal[] = []
protected category?: string
protected panelManager: PanelManager
protected serializer?: SerializerBase
protected serializer?: GrpcSerializerBase
protected reporter?: GrpcReporter
protected featuresState$?

Expand Down Expand Up @@ -270,7 +270,7 @@ export class Kernel implements Disposable {
this.category = category
}

setSerializer(serializer: GrpcSerializer) {
setSerializer(serializer: GrpcSerializerBase) {
this.serializer = serializer
}

Expand Down Expand Up @@ -315,7 +315,7 @@ export class Kernel implements Disposable {
}

async #setNotebookMode(notebookDocument: NotebookDocument): Promise<void> {
const isSessionsOutput = GrpcSerializer.isDocumentSessionOutputs(notebookDocument.metadata)
const isSessionsOutput = GrpcSerializerBase.isDocumentSessionOutputs(notebookDocument.metadata)
const notebookMode = isSessionsOutput ? NotebookMode.SessionOutputs : NotebookMode.Execution
await ContextState.addKey(NOTEBOOK_MODE, notebookMode)
}
Expand Down Expand Up @@ -668,7 +668,7 @@ export class Kernel implements Disposable {

private async _executeAll(cells: NotebookCell[]) {
const sessionOutputsDoc = cells.find((c) =>
GrpcSerializer.isDocumentSessionOutputs(c.notebook.metadata),
GrpcSerializerBase.isDocumentSessionOutputs(c.notebook.metadata),
)
if (sessionOutputsDoc) {
const { notebook } = sessionOutputsDoc
Expand Down
Loading