I'm trying to restart a Jupyter Lab server (not just the kernels) running in the background of an AWS SageMaker notebook instance. I have already tried the following:
Killing the server by it's process ID
pgrep doesn't show me the process
pkill can't find the process
ps aux shows the process ID as constantly changing
Stopping the server through jupyter notebook stop
I get an SSL error and nothing happens
The only thing I've been able to do is reboot the entire instance, which isn't a great option as it can take awhile to become available again.
Edit 1:
The main reason I am trying to do this is that after installing the tqdm package and trying to use tqdm.notebook in Jupyter Lab, in order for it to display correctly I need to enable/install notebook and lab extensions. In order for these to take effect the server then needs to be restarted.
Try this:
Left hand navbar, Commands
Navigate to the Help section on the popout menu
Reset Application State
Both classic Jupyter and Jupyter lab live within the same process.
sudo initctl restart jupyter-server --no-wait is what AWS suggest in https://forums.aws.amazon.com/thread.jspa?messageID=917594󠁚
Assuming it runs on port 8888:
jupyter lab stop 8888 && jupyter lab
Related
I have already tried user-data method and rc.local methods but none are working. I am not a pro so would like some help on this.
These are the 3 commands i want to run on every startup of ec2 instance:
tmux (start a tmux session so i dont loose the data when connection resets)
source pyenv/bin/activate (Activate the venv)
jupyter-lab --ip 0.0.0.0 --no-browser --allow-root (run the jupyter lab)
I'm using a ubuntu ec2 instance btw. Thanks in advance.
If i can acheieve this using nohup instead of tmux i'd be willing to that as well.
I wasn't able to find a solution anywhere so any help is appreciated, thank you.
looking for solution to prevent google cloud shell disconnecting when it found you idle, even it also disconnect when you run some processing and leave system idle.
message shown Connection to Cloud Shell has been lost. Any additional changes will not be saved.
This behavior is by design, as Cloud Shell is intended for interactive use only.
One way to fix it is running a ping command within a TMUX Terminal.
apt install tmux
apt update
tmux
ping google.com
Ctrl+b "
The downside of this is you'll be working halfscreen.
While using Vertex AI notebook instance kernel on GCP, the notebook gets detached everytime my system sleeps.
How can I keep my notebook running even if my system shuts down?
The Jupyter community has discussed this issue for quite a while now. There is no fix as such but there is a workaround to buffer the output and then display it when the notebook is opened again.
This answer is adopted from the comment from this Stack thread. I’ve also seen this workaround being suggested in a Jupyter Github issue.
The workaround would be to install the “Screen” utility (terminal multiplexer) on the GCE instance where JupyterHub is hosted, launch a new terminal session from JupyterHub and execute the notebook using the below “nbconvert” command.
jupyter nbconvert --to notebook --inplace --execute /home/path/to/notebook.ipynb
This way the terminal session could be preserved even if the personal computer is shut down and allow it to be resumed with the screen -r command.
I am running a virtual machine in Google Cloud. I have installed the default Debian OS, and configured the desktop environment for remote connection, as explained here: https://cloud.google.com/solutions/chrome-desktop-remote-on-compute-engine
I have been able to connect to the instance via Chrome Remote Desktop, however periodically I have the problem that the Remote Desktop says the vm instance is online, however if I try to connect to it I get:
Looking at the Google Cloud console, the instance is clearly running. Normally if I restart the instance the problem is solved, however I have processes running on the instance that I do not want to stop.
UPDATE:
Following the advice from Serhii Rohoza I ran
sudo systemctl status chrome-remote-desktop
The status looked normal, listing:
Active: active (exited) since...
I then ran
sudo systemctl restart chrome-remote-desktop
and this solved the problem, I could log into remote desktop again, but it seemed the VM instance had restarted, which is a big problem since I am running processes on it that should not shut down. I guess this is a problem to send to Google Cloud Services support.
UPDATE 2:
I'm still running into this problem. I normally have a Jupyter Notebook running on the VM - this Notebook must keep running. When I saw the message saying that the remote computer is offline, I logged in via ssh and checked if the Jupyter Notebook is running:
jupyter notebook list
This returned:
http://localhost:8888/?token=9110bf40789971b5e252a272e9497039b4f3b45e506348df :: /home/qgenixtech
So the Notebook was running. I then ran:
sudo systemctl restart chrome-remote-desktop
and after that again:
jupyter notebook list
and then it shows no Notebooks running. So the restart command closed down the Notebook (and also all other open windows on the desktop).
UPDATE 3:
I spoke to a support technician at Google. The problem is on the Remote Desktop side, not the virtual machine. According to the technician this is a known problem, by he didn't have a solution for it. He referred me to these two links from Google Support:
https://support.google.com/chrome/thread/10213547?hl=en
https://support.google.com/chrome/thread/3333421?hl=en
The next option for me is to look at something like X2go
To solve your issue you should follow documentation Troubleshooting and check status of the Chrome Remote Desktop service with command:
sudo systemctl status chrome-remote-desktop
and check log messages at /tmp/chrome_remote_desktop_DATE_TIME_*.
To investigate why your VM instance was restarted you should look for some clues at the logs:
Go to Compute Engine -> VM instances -> click on NAME_OF_YOUR_VM -> find section Logs -> click on Stackdriver Logging. More information you can find in the documentation Viewing logs (Classic)
Go to Compute Engine -> VM instances -> click on NAME_OF_YOUR_VM -> find section Logs -> click on Serial port 1 (console). More information in the documentation Viewing Serial Port Output
You can contact with Google Cloud Support as well.
In addition, have a look at the documentation Setting instance availability policies.
same issue. when checking logs i see:
2021-01-05 14:29:38,319:INFO:Starting Xvfb on display :20
xdpyinfo: unable to open display ":20".
2021-01-05 14:29:40,837:INFO:X server is active.
restarting service or even VM doesn't work.
i need to delete connection on "client" and re-auth with /headless link
When I connect to EC2 instance via Mobaxterm, after some period of time my jupyter notebook's kernel loses connection.
And some highly time-consuming operations /(Currently running tasks) are required to be re-performed again and again and are never-ending (This repeats each and every time).
I'm closing the notebook and restarting, so I can gain a connection to the kernel because it doesn't reconnect and I had to go through the process again and again when it dies eventually.
It also shows SSL error, wrong version number sometimes before disconnecting.
I have also faced a similar problem. I solved it with the help of 'tmux'.
I followed these steps:
I installed 'tmux' in my machine in the AWS instance.
[Actually, it came preinstalled with the AMI I had been using on the EC2 instance.]
I created a 'tmux' session simply by entering the command: tmux
Then I ran necessary commands to run the Jupyter server or Jupyter notebook
To close the terminal, I used this command: (i) ctrl + b, (ii) d
[Please notice, the session will continue running on the EC2 instance until you close the instance or close the jupyter server or the jupyter notebook].
To connect to the session again, I used the command: tmux attach
To finally kill the 'tmux' session when I am done, I used the command: tmux kill-session
Just use nohup. This should be the builtin tool in all Linux machines.
So you should do: nohup jupyter notebook > output.txt
And then you can safely terminate the console session without worrying about killing the notebook.