Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

notify when execution/command is completed

Tags:

How do I get IPython to notify me when a command has been executed? Can I get it to use the bell/alert, or by pop-up? I'm running Anaconda on iTerm on OS X 10.8.5.

like image 637
psquid Avatar asked Feb 25 '14 04:02

psquid


People also ask

What happens when you execute a command in the shell?

Running the CommandThe shell makes a copy of itself, a process called forking. This copy of the shell replaces itself with the command, with all of the arguments that were processed earlier. This is known as an "exec," and the combined process is known as "fork-and-exec."

What happens when & is added to the end of a command?

The & makes the command run in the background. From man bash : If a command is terminated by the control operator &, the shell executes the command in the background in a subshell.


1 Answers

Finally someone created a nice library for it.

You just install it:

pip install jupyternotify

Import it in your notebook:

import jupyternotify
ip = get_ipython()
ip.register_magics(jupyternotify.JupyterNotifyMagics)

and use a magic command:

%%notify
import time
time.sleep(5)

and get a nice notification:

enter image description here

Git-page also shows how to load it automatically.

like image 169
Salvador Dali Avatar answered Oct 22 '22 01:10

Salvador Dali