I am trying to run a Jupyter Notebook in the background. I found this question that included the command
jupyter notebook &> /dev/null &
which worked on my local machine. However, I have two problems:
I need a token in order to be able to access my notebooks in a browser window. However, with the above command, there is no output into the Terminal window except for the process ID, and therefore I could not access my notebooks.
I also need to run the notebook in the background on a remote machine. I ssh into the remote machine, and then run jupyter notebook --no-browser. However, once I close my laptop, the notebook process is killed in my local Terminal window, as well as the ssh.
I was able to crudely circumvent the above problems by running the normal
jupyter notebook --no-browser
in the remote server, and then killing the ssh to the remote server. My question boils down to the following two sub-questions:
Is there any way of doing this besides closing the ssh? I guess this isn't really the biggest problem, but it seems very hacky to simply kill the ssh instead of some more elegant or more effective solution.
How would I achieve the same thing on my local machine? I need to run the Jupyter Notebook in the background while also somehow getting the output. Can I direct the output into another file or read it somewhere else?
Generate a password for your Jupyter Notebook server so that you don't need to enter it via token (which will be changed each time you restart the server).
Run your Jupyter Notebook server in a screen or a tmux, thus each time you close the connection with the remote server, you just detach from the screen. It will keep on running in your remote server. Next time you want to access to it, just tap in screen -r to attach the screen after you ssh to the remote server.
Run the Jupyter notebook on tmux with no-browser option. And take the browser when you want it. To keep the running session like variables and all, you can make use of nbconvert in Jupyter, use the command : jupyter nbconvert --to notebook --execute --inplace mynotebook.ipynb to get the outputs on Jupyter notebook when you open it on browser after detaching several times.
Related
I'm trying to launch a graphic program on a host. The program is launched from a batch file which resides on the host.
My host is Windows 10, my client is Windows Server 2008.
I tried using ssh through PuTTy and and through CygWin, getting the same results.
After launching the program from the client, it is running properly on the host - I can see the CPU usage go up and the output is written to file. However, nothing is displayed on the host's screen.
I have one user on the host, Administrator, and that is the one that I logged into through ssh.
When I launch the batch file directly from the host, everything works fine - I do see the program display properly.
Any idea why this is happening?
Thanks!
From everything I've seen, this is indeed not possible on Windows 10, at least not without some serious hacking. Instead, we're using the Python package xmlrpc, which is great for this sort of thing.
I am running a python machine learning script on google cloud platform. I have connected through SSH in browser. When I run the code it works, but when I close the browser it seems to stop running.
I believe I can make it run in the background with nohup, but I want to be able to check back in on it as it prints outputs on its progress.
Basically I want to be able to start the script, close the terminal and then reconnect from any machine to check on its progress. Any help would be really appreciated.
I am new to google cloud platform if any of this was unclear please as an ill try providing more detail.
You may use an app called as screen. Just install it using `sudo apt-get install screen`` (if debian, ubuntu).
In some cases it might be already installed in your instance, you may check it.
Once installed enter the following command into the terminal:
screen
and press enter. Now, You may start with your job in terminal.
The moment you need to disconnect you may press Ctrl+A and then d.
The session would be disconnected. You may note the session id that would be displayed (eg. detached from 1498.pts-1.server)
You may now close the terminal.
When you come back, use the following command to get back into the older session.
screen -r *screen_id* (eg. screen -r **1498.pts-1.server**)
This process is checked for google cloud, ssh through browser, it really works.
Check this site for mode details.
It sounds like you're referring to the Google Cloud Shell feature. If so then what you desire is not possible, the cloud shell is not intended for non-interactive operation. From Usage limits:
Cloud Shell is intended for interactive use only. Non-interactive
sessions will be ended automatically after a warning.
The cloud shell operates on a temporary Compute Engine virtual machine, which is running only while the cloud shell session is active in the browser.
Apart from the obvious approach of keeping the browser session active while your application is running, you could also provision yourself a non-temporary Compute Engine instance (a free one is available), to which you can connect and on which you can run non-interactive applications as you desire.
Is it possible to have an IPython notebook upon in your own local browser, but it is running on a remote machine?
How does one actually access an IPython notebook running remotely using ssh?
Quoth the extensive Jupyter Documentation for Running a Notebook Server:
The Jupyter notebook web application is based on a server-client structure. The notebook server uses a two-process kernel architecture based on ZeroMQ, as well as Tornado for serving HTTP requests.
This document describes how you can secure a notebook server and how to run it on a public interface.
If you store your iPython notebook on GitHub or GitHub Gist or any file service (DropBox) then you can point http://nbviewer.jupyter.org/ to your file and view it online.
Or you can export your notebook to HTML https://ipython.org/ipython-doc/1/interactive/nbconvert.html
this may be less necessary as GitHub displays iPython notebooks directly now (try https://github.com/jakevdp/sklearn_pycon2015/blob/master/notebooks/02.1-Machine-Learning-Intro.ipynb)
The code for nbViewer is also on GitHub https://github.com/jupyter/nbviewer
Let me know if you need to modify notebooks remotely or just view them.
I'm trying to forward an X11 window from a remote server. Usually I can do something like
ssh -X some#address
and then for example run
feh image.jpg
to see the image.jpg picture on my local machine. Is it possible to get that behaviour in Capistrano 3? I'm installing a software and it requires me to do the usual "nextnextnextfinish". I want to do something similar to (inside the config/deploy.rb)
set ssh_option, {:forward_x11 => true} #doesn't work
but it seems that sshkit doesn't have that option. Is there a list of the ssh_option for sshkit somewhere or is there another solution to this?
Capistrano is to automate deployment using some sort of *sh script on the remote computer. Forwarding X11 Windows would make the user having to interact with the window. Therefore I ended up using a Bash script, Sikuli and Xvfb to automate the solution.
I want to be able to launch a VM in headless mode and log the outputs of its tty to the command line.
Basically I have a situation where the VM will be launched remotely (hence the command line requirement), but every once and a while, the VM's bootup sequence freezes, and right now there's no way for me to debug why the VM is not booting up properly unless I go there manually and view it in a non-headless mode.
The VM itself does not have a GUI, it just boots into TTY mode.
So is there anyway I can get some debugging output from the TTY while it's headless?
One crazy idea would be using non-headless mode and taking screenshots of the window that opens, but there must be a better way!
You can use the following command to output a PNG file of the current screen, even in headless mode:
vboxmanage controlvm [vmname] screenshotpng screen.png
I am trying to get some integration testing for bootstrapped virtualboxes up and running and ran into the exact same problem. After finding out that VRDP is a dead end, because RDP cannot send text but only bitmaps, I remembered that some cloud providers require grub to output to ttyS0.
What is ttyS0 you ask? It's the serial console of course :-)
Here's how to configure Debian to output to serial console
VirtualBox allows you to redirect the serial port into either a file or a pipe, meaning you should be able to get all the information you desire by simply reading the specified filepath.