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

support run bench tpcc on playground #56

Merged
merged 1 commit into from
Jul 22, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
38 changes: 37 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,22 @@
"command": "ticode.playground.restart",
"title": "Restart"
},
{
"command": "ticode.playground.tpccPrepare",
"title": "TPCC-Prepare"
},
{
"command": "ticode.playground.tpccRun",
"title": "TPCC-Run"
},
{
"command": "ticode.playground.tpccCleanUp",
"title": "TPCC-CleanUp"
},
{
"command": "ticode.playground.tpccCheck",
"title": "TPCC-Check"
},
{
"command": "ticode.cluster.refresh",
"title": "TiCode: Refresh Cluters",
Expand Down Expand Up @@ -342,6 +358,26 @@
"when": "view == ticode-tiup-playground && viewItem =~ /^playground-instance-tidb/",
"group": "1@1"
},
{
"command": "ticode.playground.tpccPrepare",
"when": "view == ticode-tiup-playground && viewItem =~ /^playground-instance-tidb/",
"group": "2@1"
},
{
"command": "ticode.playground.tpccRun",
"when": "view == ticode-tiup-playground && viewItem =~ /^playground-instance-tidb/",
"group": "2@2"
},
{
"command": "ticode.playground.tpccCleanUp",
"when": "view == ticode-tiup-playground && viewItem =~ /^playground-instance-tidb/",
"group": "2@3"
},
{
"command": "ticode.playground.tpccCheck",
"when": "view == ticode-tiup-playground && viewItem =~ /^playground-instance-tidb/",
"group": "2@4"
},
{
"command": "ticode.playground.debugCluster",
"when": "view == ticode-tiup-playground && viewItem == playground-cluster",
Expand Down Expand Up @@ -520,4 +556,4 @@
"shelljs": "^0.8.4",
"tmp": "^0.2.1"
}
}
}
15 changes: 13 additions & 2 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,18 @@ export async function activate(context: vscode.ExtensionContext) {
registerCommand('ticode.playground.connectMySQL', (treeItem) => {
PlaygroundCommand.connectMySQL(tiup)
}),

registerCommand('ticode.playground.tpccPrepare', (treeItem) => {
PlaygroundCommand.tpccPrepare(tiup)
}),
registerCommand('ticode.playground.tpccRun', (treeItem) => {
PlaygroundCommand.tpccRun(tiup)
}),
registerCommand('ticode.playground.tpccCleanUp', (treeItem) => {
PlaygroundCommand.tpccCleanUp(tiup)
}),
registerCommand('ticode.playground.tpccCheck', (treeItem) => {
PlaygroundCommand.tpccCheck(tiup)
}),
/**
* TiUP Cluster
*/
Expand Down Expand Up @@ -349,7 +360,7 @@ export async function activate(context: vscode.ExtensionContext) {
}

// this method is called when your extension is deactivated
export function deactivate() {}
export function deactivate() { }

function registerCommand(
command: string,
Expand Down
20 changes: 20 additions & 0 deletions src/playground/command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,26 @@ export class PlaygroundCommand {
tiup.invokeAnyInNewTerminal(cmd, 'connect tidb')
}

static async tpccPrepare(tiup: TiUP) {
const cmd = `tiup bench tpcc prepare --host 127.0.0.1 --port 4000 --user root`
tiup.invokeAnyInNewTerminal(cmd, 'TPCC Prepare')
}

static async tpccRun(tiup: TiUP) {
const cmd = `tiup bench tpcc run --host 127.0.0.1 --port 4000 --user root`
tiup.invokeAnyInNewTerminal(cmd, 'TPCC Run')
}

static async tpccCleanUp(tiup: TiUP) {
const cmd = `tiup bench tpcc cleanup --host 127.0.0.1 --port 4000 --user root`
tiup.invokeAnyInNewTerminal(cmd, 'TPCC CleanUp')
}

static async tpccCheck(tiup: TiUP) {
const cmd = `tiup bench tpcc check --host 127.0.0.1 --port 4000 --user root`
tiup.invokeAnyInNewTerminal(cmd, 'TPCC Check')
}

static async stopPlayground() {
// use "ps ax" instead of "ps aux" make the PID first column
let cr = await shell.exec('ps ax | grep tiup-playground | grep -v grep')
Expand Down