Skip to content

Commit 6256a72

Browse files
notebook needs to know where it is
1 parent cc97f58 commit 6256a72

File tree

1 file changed

+106
-208
lines changed

1 file changed

+106
-208
lines changed
Lines changed: 106 additions & 208 deletions
Original file line numberDiff line numberDiff line change
@@ -1,212 +1,110 @@
11
{
2-
"metadata": {
3-
"kernelspec": {
4-
"name": "powershell",
5-
"display_name": "PowerShell"
6-
},
7-
"language_info": {
8-
"name": "powershell",
9-
"mimetype": "text/x-sh",
10-
"file_extension": ".ps1",
11-
"codemirror_mode": "shell"
12-
}
13-
},
14-
"nbformat_minor": 2,
15-
"nbformat": 4,
16-
"cells": [
17-
{
18-
"cell_type": "markdown",
19-
"source": [
20-
"# Cleaning up the containers and directories and files\n",
21-
"\n",
22-
"The code below will clean up the files that have been created and remove the docker containers but not the image so that you can run this notebook again without having to download the image again"
23-
],
24-
"metadata": {
25-
"azdata_cell_guid": "bf39922e-c732-4c24-8630-1694d703c50e"
26-
}
27-
},
28-
{
29-
"cell_type": "code",
30-
"source": [
31-
"$FolderPath = $Env:USERPROFILE + '\\Documents\\dbatoolsdemo'\n",
32-
"Write-Output \"Removing containers\"\n",
33-
"\n",
34-
" $NotebookDir = Read-Host \"Please enter path to the notebook. Azure Data Studio doesnt know where it is\"\n",
35-
" Set-Location $NotebookDir\n",
36-
" docker-compose down \n",
37-
"\n",
38-
"\n",
39-
"Write-Output \"Removing directories and files\"\n",
40-
"Remove-Item $FolderPath -Recurse -Force\n",
41-
"Write-Output \"Removed everything\"\n",
42-
""
43-
],
44-
"metadata": {
45-
"azdata_cell_guid": "45750e3c-b1a5-430f-b79c-d85430564841"
46-
},
47-
"outputs": [
48-
{
49-
"name": "stdout",
50-
"text": "Removing containers\r\n",
51-
"output_type": "stream"
52-
},
53-
{
54-
"name": "stdout",
55-
"text": "Stopping dbatools_SQL2019_1 ... \r\n",
56-
"output_type": "stream"
57-
},
58-
{
59-
"name": "stdout",
60-
"text": "\r\n",
61-
"output_type": "stream"
62-
},
63-
{
64-
"name": "stdout",
65-
"text": "Stopping dbatools_SQL2019-1_1 ... \r\n",
66-
"output_type": "stream"
67-
},
68-
{
69-
"name": "stdout",
70-
"text": "\r\n",
71-
"output_type": "stream"
72-
},
73-
{
74-
"name": "stdout",
75-
"text": "\u001b[1A\u001b[2K\r\n",
76-
"output_type": "stream"
77-
},
78-
{
79-
"name": "stdout",
80-
"text": "Stopping dbatools_SQL2019-1_1 ... \u001b[32mdone\u001b[0m\r\n",
81-
"output_type": "stream"
82-
},
83-
{
84-
"name": "stdout",
85-
"text": "\u001b[1B\u001b[2A\u001b[2K\r\n",
86-
"output_type": "stream"
87-
},
88-
{
89-
"name": "stdout",
90-
"text": "Stopping dbatools_SQL2019_1 ... \u001b[32mdone\u001b[0m\r\n",
91-
"output_type": "stream"
92-
},
93-
{
94-
"name": "stdout",
95-
"text": "\u001b[2BRemoving dbatools_SQL2019_1 ... \r\n",
96-
"output_type": "stream"
97-
},
98-
{
99-
"name": "stdout",
100-
"text": "\r\n",
101-
"output_type": "stream"
102-
},
103-
{
104-
"name": "stdout",
105-
"text": "Removing dbatools_SQL2019-1_1 ... \r\n",
106-
"output_type": "stream"
107-
},
108-
{
109-
"name": "stdout",
110-
"text": "\r\n",
111-
"output_type": "stream"
112-
},
113-
{
114-
"name": "stdout",
115-
"text": "\u001b[1A\u001b[2K\r\n",
116-
"output_type": "stream"
117-
},
118-
{
119-
"name": "stdout",
120-
"text": "Removing dbatools_SQL2019-1_1 ... \u001b[32mdone\u001b[0m\r\n",
121-
"output_type": "stream"
122-
},
123-
{
124-
"name": "stdout",
125-
"text": "\u001b[1B\u001b[2A\u001b[2K\r\n",
126-
"output_type": "stream"
127-
},
128-
{
129-
"name": "stdout",
130-
"text": "Removing dbatools_SQL2019_1 ... \u001b[32mdone\u001b[0m\r\n",
131-
"output_type": "stream"
132-
},
133-
{
134-
"name": "stdout",
135-
"text": "\u001b[2BRemoving network dbatools_BeardsMagicNetwork\r\n",
136-
"output_type": "stream"
137-
},
138-
{
139-
"name": "stdout",
140-
"text": "Removing directories and files\r\n",
141-
"output_type": "stream"
142-
},
143-
{
144-
"name": "stdout",
145-
"text": "\u001b[91mRemove-Item: \r\n",
146-
"output_type": "stream"
147-
},
148-
{
149-
"name": "stdout",
150-
"text": "\u001b[96mLine |\r\n",
151-
"output_type": "stream"
152-
},
153-
{
154-
"name": "stdout",
155-
"text": "\u001b[96m 10 | \u001b[0m \u001b[96mRemove-Item $FolderPath -Recurse -Force\u001b[0m\r\n",
156-
"output_type": "stream"
157-
},
158-
{
159-
"name": "stdout",
160-
"text": "\u001b[96m | \u001b[91m ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\r\n",
161-
"output_type": "stream"
162-
},
163-
{
164-
"name": "stdout",
165-
"text": "\u001b[91m\u001b[96m | \u001b[91mCannot find path 'C:\\Users\\mrrob\\Documents\\dbatoolsdemo' because it does not exist.\u001b[0m\r\n",
166-
"output_type": "stream"
167-
},
168-
{
169-
"name": "stdout",
170-
"text": "Removed everything\r\n",
171-
"output_type": "stream"
2+
"metadata": {
3+
"kernelspec": {
4+
"name": "powershell",
5+
"display_name": "PowerShell",
6+
"language": "powershell"
7+
},
8+
"language_info": {
9+
"name": "powershell",
10+
"codemirror_mode": "shell",
11+
"mimetype": "text/x-sh",
12+
"file_extension": ".ps1"
17213
}
173-
],
174-
"execution_count": 17
17514
},
176-
{
177-
"cell_type": "code",
178-
"source": [
179-
"docker ps -a"
180-
],
181-
"metadata": {
182-
"azdata_cell_guid": "06243d1c-1e53-4a2a-9cae-47c6934eb20c"
183-
},
184-
"outputs": [
185-
{
186-
"name": "stdout",
187-
"text": "CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES\r\n",
188-
"output_type": "stream"
15+
"nbformat_minor": 2,
16+
"nbformat": 4,
17+
"cells": [
18+
{
19+
"cell_type": "markdown",
20+
"source": [
21+
"# Cleaning up the containers and directories and files\n",
22+
"\n",
23+
"The code below will clean up the files that have been created and remove the docker containers but not the image so that you can run this notebook again without having to download the image again.\n",
24+
"\n",
25+
"You will need to enter the path to this notebook for the `$NotebookDir` variable"
26+
],
27+
"metadata": {
28+
"azdata_cell_guid": "bf39922e-c732-4c24-8630-1694d703c50e"
29+
}
30+
},
31+
{
32+
"cell_type": "code",
33+
"source": [
34+
"$NotebookDir = '' # Enter the path to the notebook here\n",
35+
"$FolderPath = $Env:USERPROFILE + '\\Documents\\dbatoolsdemo'\n",
36+
"Write-Output \"Removing containers\"\n",
37+
"\n",
38+
"Set-Location $NotebookDir\n",
39+
"docker-compose down \n",
40+
"\n",
41+
"\n",
42+
"Write-Output \"Removing directories and files\"\n",
43+
"Remove-Item $FolderPath -Recurse -Force\n",
44+
"Write-Output \"Removed everything\"\n",
45+
""
46+
],
47+
"metadata": {
48+
"azdata_cell_guid": "45750e3c-b1a5-430f-b79c-d85430564841"
49+
},
50+
"outputs": [
51+
{
52+
"name": "stdout",
53+
"text": "Removing containers\nRead-Host : Windows PowerShell is in NonInteractive mode. Read and Prompt functionality is not available.\nAt line:4 char:20\n+ ... tebookDir = Read-Host \"Please enter path to the notebook. Azure Data ...\n+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n + CategoryInfo : InvalidOperation: (:) [Read-Host], PSInvalidOperationException\n + FullyQualifiedErrorId : InvalidOperation,Microsoft.PowerShell.Commands.ReadHostCommand\n \n",
54+
"output_type": "stream"
55+
},
56+
{
57+
"name": "stdout",
58+
"text": "Set-Location : Cannot process argument because the value of argument \"path\" is null. Change the value of argument \"path\" to a non-null value.\nAt line:5 char:5\n+ Set-Location $NotebookDir\n+ ~~~~~~~~~~~~~~~~~~~~~~~~~\n + CategoryInfo : InvalidArgument: (:) [Set-Location], PSArgumentNullException\n + FullyQualifiedErrorId : ArgumentNull,Microsoft.PowerShell.Commands.SetLocationCommand\n \n",
59+
"output_type": "stream"
60+
},
61+
{
62+
"name": "stdout",
63+
"text": "\n Can't find a suitable configuration file in this directory or any\n parent. Are you in the right directory?\n\n Supported filenames: docker-compose.yml, docker-compose.yaml\n \n",
64+
"output_type": "stream"
65+
},
66+
{
67+
"name": "stdout",
68+
"text": "Removing directories and files\nRemoved everything\n",
69+
"output_type": "stream"
70+
}
71+
],
72+
"execution_count": 1
73+
},
74+
{
75+
"cell_type": "code",
76+
"source": [
77+
"docker ps -a"
78+
],
79+
"metadata": {
80+
"azdata_cell_guid": "06243d1c-1e53-4a2a-9cae-47c6934eb20c"
81+
},
82+
"outputs": [
83+
{
84+
"output_type": "stream",
85+
"name": "stdout",
86+
"text": "CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES\r\n"
87+
}
88+
],
89+
"execution_count": 18
90+
},
91+
{
92+
"cell_type": "code",
93+
"source": [],
94+
"metadata": {
95+
"azdata_cell_guid": "996a4a76-17b3-4e4f-8fdb-fa560b21f238"
96+
},
97+
"outputs": [],
98+
"execution_count": null
99+
},
100+
{
101+
"cell_type": "code",
102+
"source": [],
103+
"metadata": {
104+
"azdata_cell_guid": "5fca1884-f586-49fa-a314-65c111e7cdb3"
105+
},
106+
"outputs": [],
107+
"execution_count": null
189108
}
190-
],
191-
"execution_count": 18
192-
},
193-
{
194-
"cell_type": "code",
195-
"source": [],
196-
"metadata": {
197-
"azdata_cell_guid": "996a4a76-17b3-4e4f-8fdb-fa560b21f238"
198-
},
199-
"outputs": [],
200-
"execution_count": null
201-
},
202-
{
203-
"cell_type": "code",
204-
"source": [],
205-
"metadata": {
206-
"azdata_cell_guid": "5fca1884-f586-49fa-a314-65c111e7cdb3"
207-
},
208-
"outputs": [],
209-
"execution_count": null
210-
}
211-
]
212-
}
109+
]
110+
}

0 commit comments

Comments
 (0)