Commit eec87b8
authored
Set notebook directory as current directory for pip installs from workspace fs (#961)
When users use a relative path to install a notebook scoped library with
pip (eg `%pip install ../../foo`) it can fail since cwd for shell
commands can be an ephemeral directory in DBRs < 14.0.
For other shell commands, our preamble handles the cwd, but pip commands
are moved to the beginning of the notebook, since they can lead to a
kernel restart and hence loss of preamble. This means, they can't access
the features of the full preamble and need an explicit `os.chdir` to set
the correct path.
## Changes
* Add an explicit `os.chdir(notebook_dir)` before each `%pip install`.
* Also remove code to pass source_file and project_root to the wrappers
as notebook params (for notebook jobs) and cli args (for python file
jobs). Now these parameters are hard coded into the wrapper. These are
updated on every run since the wrapper is recreated on every run.
## Tests
* manual
Fixes #9581 parent c9864e1 commit eec87b8
File tree
5 files changed
+124
-116
lines changed- packages/databricks-vscode
- resources/python
- src
- run
- workspace-fs
5 files changed
+124
-116
lines changedLines changed: 2 additions & 20 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
8 | | - | |
9 | | - | |
10 | | - | |
11 | | - | |
12 | | - | |
13 | | - | |
14 | | - | |
15 | | - | |
16 | | - | |
17 | | - | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
| 7 | + | |
| 8 | + | |
27 | 9 | | |
28 | 10 | | |
29 | 11 | | |
| |||
Lines changed: 7 additions & 17 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
| 7 | + | |
6 | 8 | | |
7 | | - | |
8 | | - | |
9 | | - | |
10 | | - | |
11 | | - | |
12 | | - | |
| 9 | + | |
| 10 | + | |
13 | 11 | | |
14 | | - | |
15 | | - | |
16 | | - | |
17 | | - | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
| 12 | + | |
| 13 | + | |
24 | 14 | | |
25 | 15 | | |
26 | | - | |
| 16 | + | |
27 | 17 | | |
28 | 18 | | |
29 | 19 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
173 | 173 | | |
174 | 174 | | |
175 | 175 | | |
176 | | - | |
177 | | - | |
178 | | - | |
179 | | - | |
180 | | - | |
181 | | - | |
182 | | - | |
183 | | - | |
184 | | - | |
185 | | - | |
| 176 | + | |
186 | 177 | | |
187 | 178 | | |
188 | 179 | | |
| |||
200 | 191 | | |
201 | 192 | | |
202 | 193 | | |
203 | | - | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
204 | 198 | | |
205 | 199 | | |
206 | 200 | | |
207 | | - | |
208 | | - | |
209 | | - | |
210 | | - | |
211 | | - | |
212 | | - | |
| 201 | + | |
213 | 202 | | |
214 | 203 | | |
215 | 204 | | |
| |||
Lines changed: 52 additions & 25 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
76 | 76 | | |
77 | 77 | | |
78 | 78 | | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
79 | 98 | | |
80 | 99 | | |
81 | 100 | | |
| |||
100 | 119 | | |
101 | 120 | | |
102 | 121 | | |
103 | | - | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
104 | 126 | | |
105 | | - | |
106 | | - | |
107 | | - | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
108 | 130 | | |
109 | 131 | | |
110 | 132 | | |
| |||
165 | 187 | | |
166 | 188 | | |
167 | 189 | | |
168 | | - | |
169 | | - | |
170 | | - | |
171 | | - | |
172 | | - | |
173 | | - | |
174 | | - | |
175 | | - | |
176 | | - | |
177 | | - | |
178 | | - | |
179 | | - | |
180 | | - | |
181 | | - | |
182 | | - | |
183 | | - | |
184 | | - | |
185 | 190 | | |
186 | 191 | | |
187 | 192 | | |
| |||
202 | 207 | | |
203 | 208 | | |
204 | 209 | | |
205 | | - | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
206 | 214 | | |
207 | 215 | | |
208 | 216 | | |
| |||
244 | 252 | | |
245 | 253 | | |
246 | 254 | | |
247 | | - | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
248 | 259 | | |
249 | 260 | | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
250 | 265 | | |
251 | 266 | | |
252 | 267 | | |
| |||
377 | 392 | | |
378 | 393 | | |
379 | 394 | | |
380 | | - | |
| 395 | + | |
381 | 396 | | |
382 | 397 | | |
383 | 398 | | |
| |||
448 | 463 | | |
449 | 464 | | |
450 | 465 | | |
451 | | - | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
452 | 479 | | |
453 | 480 | | |
454 | 481 | | |
| |||
0 commit comments