Skip to content

Block exec until sync is complete - #134

Merged
shreyas-goenka merged 28 commits into
mainfrom
race-exec
Oct 27, 2022
Merged

Block exec until sync is complete#134
shreyas-goenka merged 28 commits into
mainfrom
race-exec

Conversation

@shreyas-goenka

@shreyas-goenka shreyas-goenka commented Oct 24, 2022

Copy link
Copy Markdown
Contributor

This PR adds code to parse logs from bricks sync to compute the state of sync completeness. If sync is in progress (ie upload/delete requests are inflight to the workspace), we block execution in the databricks runner

Video for exec:
https://user-images.githubusercontent.com/88374338/197779331-4b560bcf-63b2-4239-a3fb-4ee7a0814b62.mov

Video for exec as workflow

Screen.Recording.2022-10-26.at.2.47.54.PM.mov

@shreyas-goenka
shreyas-goenka requested review from fjakobs and kartikgupta-db and removed request for fjakobs October 24, 2022 17:30
const extensionVersion = require("../../package.json").version;

export type ConnectionState = "CONNECTED" | "CONNECTING" | "DISCONNECTED";
export type SyncStatus = "IN_PROGRESS" | "WATCHING_FOR_CHANGES" | "INACTIVE";

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We already have a sync state in code synchroniser. We can extend that with more states.

@shreyas-goenka shreyas-goenka Oct 25, 2022

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Its easier to have this state in connection manager, because this is a object that already being passed into databricks runtime (the vscode runner). To keep it in code synchroniser would require refactoring to have code synchroniser inside the connection manager or somewhere accessible to databricks runtime.

Can do this refactor if recommended

cc: @fjakobs

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I agree with @kartikgupta-db. This should become part of CodeSynchronizer.ts. It gets confusing otherwise.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can this go now?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

It is no longer referenced

Comment on lines +277 to +279
} else {
this.connection.syncStatus = "IN_PROGRESS";
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We will also need an emitter for state change from "watching for changes" -> "in progress". Something like onDidStartSync.

Alternatively, you can have a common emitter, onDidSyncStateChange that fires on every state transition.

@shreyas-goenka shreyas-goenka Oct 25, 2022

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Added an emitter into connection manager. For now it only fires for "in_progress" -> "watching for changes" because that's the only event we care about. Easily modifiable if we need in the future

@shreyas-goenka shreyas-goenka changed the title WIP Block exec until sync is complete Oct 25, 2022
Comment thread packages/databricks-vscode/src/run/DabaricksRuntime.ts Outdated
@shreyas-goenka

Copy link
Copy Markdown
Contributor Author

In Progress: separate out the parsing logic into a separate PR and write unit tests

Comment thread packages/databricks-vscode/src/cli/BricksTasks.test.ts Outdated
Comment thread packages/databricks-vscode/src/cli/BricksTasks.ts Outdated
Comment thread packages/databricks-vscode/src/cli/BricksTasks.ts Outdated
Comment thread packages/databricks-vscode/src/cli/BricksTasks.ts Outdated
Comment thread packages/databricks-vscode/src/cli/BricksTasks.ts Outdated
const extensionVersion = require("../../package.json").version;

export type ConnectionState = "CONNECTED" | "CONNECTING" | "DISCONNECTED";
export type SyncStatus = "IN_PROGRESS" | "WATCHING_FOR_CHANGES" | "INACTIVE";

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I agree with @kartikgupta-db. This should become part of CodeSynchronizer.ts. It gets confusing otherwise.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants