WEBVTT - This file was automatically generated by VIMEO

0
00:00:07.690 --> 00:00:11.350
Hi. In this video we will learn how to work with kernels.

1
00:00:15.150 --> 00:00:18.260
We can interrupt the kernel, uh,

2
00:00:18.260 --> 00:00:21.780
when you are stuck in some long-running calculation. First thing,

3
00:00:21.970 --> 00:00:24.740
what you will do is to try to interrupt the kernel.

4
00:00:25.660 --> 00:00:30.650
We can do it with ii shortcut or directly from the ui. Uh,

5
00:00:30.650 --> 00:00:35.170
when you interrupt the kernel, uh, the objects, uh, that you created, uh,

6
00:00:35.550 --> 00:00:39.170
in the notebook will be preserved. Let's run an example.

7
00:00:47.350 --> 00:00:50.890
Now our code will slip just for 20 seconds,

8
00:00:57.220 --> 00:00:59.280
and when you interrupt the kernel, this will happen

9
00:01:02.070 --> 00:01:06.610
in some situations. Uh, you want to restart the kernel when you,

10
00:01:06.630 --> 00:01:08.930
for example, make some changes in the system.

11
00:01:09.100 --> 00:01:11.250
After installation of some packages, uh,

12
00:01:11.600 --> 00:01:14.690
when interrupting the kernel doesn't help. Uh,

13
00:01:15.420 --> 00:01:19.020
when you restart the kernel, all variables will be lost,

14
00:01:19.290 --> 00:01:23.060
basically be killed. The python process, which was running the notebook.

15
00:01:23.830 --> 00:01:26.420
After that, we have to rerun whole notebook.

16
00:01:26.920 --> 00:01:31.580
If you want to continue to use each objects like data frames, variables,

17
00:01:31.580 --> 00:01:35.480
and so on. So when you have code,

18
00:01:35.850 --> 00:01:38.560
which requires, uh, long running calculations,

19
00:01:39.350 --> 00:01:42.200
best practice is to store the objects to disk.

20
00:01:43.050 --> 00:01:45.030
You can use the pick library for this.

21
00:01:50.090 --> 00:01:54.190
We can do it directly from the UI or with the, uh,

22
00:01:54.190 --> 00:01:55.230
zero zero shortcut.

23
00:02:01.180 --> 00:02:05.630
Another thing, but you can do is to change the kernel of the notebook. Uh,

24
00:02:05.650 --> 00:02:07.790
but we will not do this very frequently.

25
00:02:14.520 --> 00:02:15.580
In our next video,

26
00:02:16.200 --> 00:02:19.580
we will learn how to use kernel from other environment.
