Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google Colab - how to restart runtime using code?

I want to restart current runtime (Ctrl+M) using code. Something like:

!restart_runtime

Is there such an option?

like image 213
me2 beats Avatar asked Mar 06 '23 06:03

me2 beats


1 Answers

The runtime process will restart automatically when halted. So, one way to implement restart_runtime would be:

import os

def restart_runtime():
  os.kill(os.getpid(), 9)
like image 119
Bob Smith Avatar answered Apr 02 '23 04:04

Bob Smith