diff --git a/build/gulpfile.hygiene.js b/build/gulpfile.hygiene.js index 1b1b520d99..88330fa9d9 100644 --- a/build/gulpfile.hygiene.js +++ b/build/gulpfile.hygiene.js @@ -96,7 +96,8 @@ const indentationFilter = [ '!extensions/mssql/sqltoolsservice/**', '!extensions/import/flatfileimportservice/**', '!extensions/admin-tool-ext-win/ssmsmin/**', - '!extensions/resource-deployment/notebooks/**' + '!extensions/resource-deployment/notebooks/**', + '!extensions/mssql/notebooks/**' ]; const copyrightFilter = [ diff --git a/extensions/mssql/notebooks/TSG/cluster-status.ipynb b/extensions/mssql/notebooks/TSG/cluster-status.ipynb new file mode 100644 index 0000000000..ed2a6da2ac --- /dev/null +++ b/extensions/mssql/notebooks/TSG/cluster-status.ipynb @@ -0,0 +1,159 @@ +{ + "metadata": { + "kernelspec": { + "name": "python3", + "display_name": "Python 3" + }, + "language_info": { + "name": "python", + "version": "3.6.6", + "mimetype": "text/x-python", + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "pygments_lexer": "ipython3", + "nbconvert_exporter": "python", + "file_extension": ".py" + } + }, + "nbformat_minor": 2, + "nbformat": 4, + "cells": [ + { + "cell_type": "markdown", + "source": "\n\n# View the status of your big data cluster\nThis notebook allows you to see the status of the controller, master instance, and pools in your SQL Server big data cluster.\n\n## Important Instructions\n### **Before you begin, you will need:**\n* Big data cluster name\n* Controller username\n* Controller password\n* Controller endpoint \n\nYou can find the controller endpoint from the big data cluster dashboard in the Service Endpoints table. The endpoint is listed as **Cluster Management Service.**\n\nIf you do not know the credentials, ask the admin who deployed your cluster.\n\n### **Instructions**\n* For the best experience, click **Run Cells** on the toolbar above. This will automatically execute all code cells below and show the cluster status in each table.\n* When you click **Run Cells** for this Notebook, you will be prompted at the *Log in to your big data cluster* code cell to provide your login credentials. Follow the prompts and press enter to proceed.\n* **You won't need to modify any of the code cell contents** in this Notebook. If you accidentally made a change, you can reopen this Notebook from the bdc dashboard.\n\n\n", + "metadata": {} + }, + { + "cell_type": "markdown", + "source": "## **Dependencies**\r\n\r\n> This Notebook will try to install these dependencies for you.\r\n\r\n----------------------------------------------------------------\r\n
| Tool | \r\nRequired | \r\nDescription | \r\n
|---|---|---|
| mssqlctl | \r\nYes | \r\nCommand-line tool for installing and managing a big data cluster. | \r\n
| pandas | \r\nYes | \r\nPython Library for formatting data (More info). | \r\n
",
+ "metadata": {}
+ },
+ {
+ "cell_type": "markdown",
+ "source": "### **Install latest version of mssqlctl**",
+ "metadata": {}
+ },
+ {
+ "cell_type": "code",
+ "source": "import sys, platform\r\n\r\nif platform.system()==\"Windows\":\r\n user = ' --user'\r\nelse:\r\n user = ''\r\n\r\ndef executeCommand(cmd, successMsgs, printMsg):\r\n print(printMsg)\r\n cmdOutput = !{cmd}\r\n cmdOutput = ''.join(cmdOutput)\r\n if any(msg in cmdOutput for msg in successMsgs):\r\n print(f\"\\nSuccess >> \" + cmd)\r\n else:\r\n raise SystemExit(f'\\nFailed during:\\n\\n\\t{cmd}\\n\\nreturned: \\n' + ''.join(cmdOutput) + '.\\n')\r\n\r\ninstallPath = 'https://private-repo.microsoft.com/python/ctp3.1/mssqlctl/requirements.txt'\r\ncmd = f'{sys.executable} -m pip uninstall --yes mssqlctl-cli-storage'\r\ncmdOutput = !{cmd}\r\n\r\ncmd = f'{sys.executable} -m pip uninstall -r {installPath} --yes'\r\nexecuteCommand(cmd, ['is not installed', 'Successfully uninstalled mssqlctl'], 'Uninstalling mssqlctl:')\r\n\r\ncmd = f'{sys.executable} -m pip install -r {installPath}{user} --trusted-host helsinki'\r\ncmdOutput = !{cmd}\r\nexecuteCommand(cmd, ['Requirement already satisfied', 'Successfully installed mssqlctl'], 'Installing the latest version of mssqlctl:')",
+ "metadata": {},
+ "outputs": [],
+ "execution_count": 0
+ },
+ {
+ "cell_type": "markdown",
+ "source": "### **Install latest version of pandas**",
+ "metadata": {}
+ },
+ {
+ "cell_type": "code",
+ "source": "#install pandas\r\ncmd = f'{sys.executable} -m pip show pandas'\r\ncmdOutput = !{cmd}\r\nif len(cmdOutput) > 0 and '0.24' in cmdOutput[1]:\r\n print('Pandas required version is already installed!')\r\nelse:\r\n pandasVersion = 'pandas==0.24.2'\r\n cmd = f'{sys.executable} -m pip install {pandasVersion}'\r\n cmdOutput = !{cmd}\r\n print(f'\\nSuccess: Upgraded pandas.')",
+ "metadata": {},
+ "outputs": [],
+ "execution_count": 0
+ },
+ {
+ "cell_type": "markdown",
+ "source": "## **Log in to your big data cluster**\r\nTo view cluster status, you will need to connect to your big data cluster through mssqlctl. \r\n\r\nWhen you run this code cell, you will be prompted for:\r\n- Cluster name\r\n- Controller username\r\n- Controller password\r\n\r\nTo proceed:\r\n- **Click** on the input box\r\n- **Type** the login info\r\n- **Press** enter.\r\n\r\nIf your cluster is missing a configuration file, you will be asked to provide your controller endpoint. (Format: **https://00.00.00.000:00000**)",
+ "metadata": {}
+ },
+ {
+ "cell_type": "code",
+ "source": "import os, getpass, json\nimport pandas as pd\nimport numpy as np\nfrom IPython.display import *\n\ndef PromptForInfo(promptMsg, isPassword, errorMsg):\n if isPassword:\n promptResponse = getpass.getpass(prompt=promptMsg)\n else:\n promptResponse = input(promptMsg)\n if promptResponse == \"\":\n raise SystemExit(errorMsg + '\\n')\n return promptResponse\n\n# Prompt user inputs:\ncluster_name = PromptForInfo('Please provide your Cluster Name: ', False, 'Cluster Name is required!')\n\ncontroller_username = PromptForInfo('Please provide your Controller Username for login: ', False, 'Controller Username is required!')\n\ncontroller_password = PromptForInfo('Controller Password: ', True, 'Password is required!')\nprint('***********')\n\n!mssqlctl logout\n# Login in to your big data cluster \ncmd = f'mssqlctl login -n {cluster_name} -u {controller_username} -a yes'\nprint(\"Start \" + cmd)\nos.environ['CONTROLLER_USERNAME'] = controller_username\nos.environ['CONTROLLER_PASSWORD'] = controller_password\nos.environ['ACCEPT_EULA'] = 'yes'\n\nloginResult = !{cmd}\nif 'ERROR: Please check your kube config or specify the correct controller endpoint with: --controller-endpoint https:// ",
+ "metadata": {}
+ },
+ {
+ "cell_type": "markdown",
+ "source": "### **Controller status**\nTo learn more about the controller, [read here.](https://docs.microsoft.com/sql/big-data-cluster/concept-controller?view=sql-server-ver15)",
+ "metadata": {}
+ },
+ {
+ "cell_type": "code",
+ "source": "# Display status of controller\nresults = !mssqlctl bdc control status show\nshow_results(results)",
+ "metadata": {},
+ "outputs": [],
+ "execution_count": 0
+ },
+ {
+ "cell_type": "markdown",
+ "source": "### **Master Instance status**\nTo learn more about the master instance, [read here.](https://docs.microsoft.com/sql/big-data-cluster/concept-master-instance?view=sqlallproducts-allversions)",
+ "metadata": {}
+ },
+ {
+ "cell_type": "code",
+ "source": "# Display status of master instance\nresults = !mssqlctl bdc pool status show -k master -n default\nshow_results(results)",
+ "metadata": {},
+ "outputs": [],
+ "execution_count": 0
+ },
+ {
+ "cell_type": "markdown",
+ "source": "### **Compute Pool status**\nTo learn more about compute pool, [read here.](https://docs.microsoft.com/sql/big-data-cluster/concept-compute-pool?view=sqlallproducts-allversions)",
+ "metadata": {}
+ },
+ {
+ "cell_type": "code",
+ "source": "# Display status of compute pool\nresults = !mssqlctl bdc pool status show -k compute -n default\nshow_results(results)",
+ "metadata": {},
+ "outputs": [],
+ "execution_count": 0
+ },
+ {
+ "cell_type": "markdown",
+ "source": "### **Storage Pool status**\nTo learn more about storage pool, [read here.](https://docs.microsoft.com/sql/big-data-cluster/concept-storage-pool?view=sqlallproducts-allversions)",
+ "metadata": {}
+ },
+ {
+ "cell_type": "code",
+ "source": "# Display status of storage pools\nresults = !mssqlctl bdc pool status show -k storage -n default\nshow_results(results)",
+ "metadata": {},
+ "outputs": [],
+ "execution_count": 0
+ },
+ {
+ "cell_type": "markdown",
+ "source": "### **Data Pool status**\nTo learn more about data pool, [read here.](https://docs.microsoft.com/sql/big-data-cluster/concept-data-pool?view=sqlallproducts-allversions)",
+ "metadata": {}
+ },
+ {
+ "cell_type": "code",
+ "source": "# Display status of data pools\nresults = !mssqlctl bdc pool status show -k data -n default\nshow_results(results)",
+ "metadata": {},
+ "outputs": [],
+ "execution_count": 0
+ },
+ {
+ "cell_type": "markdown",
+ "source": "### **Spark Pool status**\nDisplays status of spark pool if it exists. Otherwise, will show as \"No spark pool.\"",
+ "metadata": {}
+ },
+ {
+ "cell_type": "code",
+ "source": "# Display status of spark pool\nif spark_exists:\n results = !mssqlctl bdc pool status show -k spark -n default\n show_results(results)\nelse:\n print('No spark pool.')",
+ "metadata": {},
+ "outputs": [],
+ "execution_count": 0
+ }
+ ]
+}
\ No newline at end of file
diff --git a/extensions/mssql/package.json b/extensions/mssql/package.json
index fd97dd1bdd..dfc5612f03 100644
--- a/extensions/mssql/package.json
+++ b/extensions/mssql/package.json
@@ -89,11 +89,11 @@
}
},
{
- "command": "mssqlCluster.livy.task.openSparkHistory",
- "title": "%title.openSparkHistory%",
+ "command": "mssqlCluster.task.openClusterStatusNotebook",
+ "title": "%title.openClusterStatusNotebook%",
"icon": {
- "dark": "resources/dark/new_spark_job_inverse.svg",
- "light": "resources/light/new_spark_job.svg"
+ "dark": "resources/dark/cluster_status_inverse.svg",
+ "light": "resources/light/cluster_status.svg"
}
},
{
@@ -247,6 +247,10 @@
{
"command": "mssqlCluster.livy.task.submitSparkJob",
"when": "false"
+ },
+ {
+ "command": "mssqlCluster.task.openClusterStatusNotebook",
+ "when": "false"
}
],
"objectExplorer/item/context": [
@@ -405,7 +409,8 @@
"tasks-widget": [
"mssqlCluster.task.newNotebook",
"mssqlCluster.task.openNotebook",
- "mssqlCluster.livy.task.submitSparkJob"
+ "mssqlCluster.livy.task.submitSparkJob",
+ "mssqlCluster.task.openClusterStatusNotebook"
]
}
},
diff --git a/extensions/mssql/package.nls.json b/extensions/mssql/package.nls.json
index be3b10400b..4eeae5d413 100644
--- a/extensions/mssql/package.nls.json
+++ b/extensions/mssql/package.nls.json
@@ -25,6 +25,7 @@
"title.tasks": "Tasks",
"title.installPackages": "Install Packages",
"title.configurePython": "Configure Python for Notebooks",
+ "title.openClusterStatusNotebook": "Cluster Status",
"title.searchServers": "Search: Servers",
"title.clearSearchServerResult": "Search: Clear Search Server Results",
diff --git a/extensions/mssql/resources/dark/cluster_status_inverse.svg b/extensions/mssql/resources/dark/cluster_status_inverse.svg
new file mode 100644
index 0000000000..971d362195
--- /dev/null
+++ b/extensions/mssql/resources/dark/cluster_status_inverse.svg
@@ -0,0 +1,13 @@
+
+
+
diff --git a/extensions/mssql/resources/dark/copy_inverse.png b/extensions/mssql/resources/dark/copy_inverse.png
new file mode 100644
index 0000000000..1770281129
Binary files /dev/null and b/extensions/mssql/resources/dark/copy_inverse.png differ
diff --git a/extensions/mssql/resources/light/cluster_status.svg b/extensions/mssql/resources/light/cluster_status.svg
new file mode 100644
index 0000000000..b2d4d4bc65
--- /dev/null
+++ b/extensions/mssql/resources/light/cluster_status.svg
@@ -0,0 +1,9 @@
+
+
+
diff --git a/extensions/mssql/resources/light/copy.png b/extensions/mssql/resources/light/copy.png
new file mode 100644
index 0000000000..776c796378
Binary files /dev/null and b/extensions/mssql/resources/light/copy.png differ
diff --git a/extensions/mssql/src/constants.ts b/extensions/mssql/src/constants.ts
index 305733b738..56b572130f 100644
--- a/extensions/mssql/src/constants.ts
+++ b/extensions/mssql/src/constants.ts
@@ -64,6 +64,7 @@ export enum MssqlClusterItemsSubType {
// SPARK JOB SUBMISSION //////////////////////////////////////////////////////////
export const mssqlClusterNewNotebookTask = 'mssqlCluster.task.newNotebook';
export const mssqlClusterOpenNotebookTask = 'mssqlCluster.task.openNotebook';
+export const mssqlopenClusterStatusNotebook = 'mssqlCluster.task.openClusterStatusNotebook';
export const mssqlClusterLivySubmitSparkJobCommand = 'mssqlCluster.livy.cmd.submitSparkJob';
export const mssqlClusterLivySubmitSparkJobFromFileCommand = 'mssqlCluster.livy.cmd.submitFileToSparkJob';
export const mssqlClusterLivySubmitSparkJobTask = 'mssqlCluster.livy.task.submitSparkJob';
diff --git a/extensions/mssql/src/main.ts b/extensions/mssql/src/main.ts
index 5c4797a347..e8f4b13900 100644
--- a/extensions/mssql/src/main.ts
+++ b/extensions/mssql/src/main.ts
@@ -137,36 +137,51 @@ export async function activate(context: vscode.ExtensionContext): Promise\r\n
\r\n\r\n \r\n\r\n\r\nColumn Name \r\nDescription \r\n\r\n \r\nKind \r\nIdentifies if component is a pod or a set. \r\n\r\n \r\nLogsURL \r\nLink to Kibana logs which is used for troubleshooting. \r\n\r\n \r\nName \r\nProvides the specific name of the pod or set. \r\n\r\n \r\nNodeMetricsURL \r\nLink to Grafana dashboard to view key metrics of the node. \r\n\r\n \r\nSQLMetricsURL \r\nLink to Grafana dashboard to view key metrics of the SQL instance \r\n\r\n \r\n\r\nState \r\nIndicates state of the pod or set.. \r\n