[Weekend Heck] Sending IPhone notification from IPython Notebook when the cell execution is done.

IPython Notebook has a useful notification feature that notifies when kernel is sitting idle i.e. all the cell execution is finished. Recently I was working on a long running python code. Most likely when the cell execution finishes I won’t be near my computer. Hence I thought of writing a magic function that can send me a message on my phone once the cell execution is done. Using some apple script heck and limiting to MacBook and iPhone, writing this phone notification magic function turned out to be pretty simple. You can find it over here.

Below is an example of how to use “phone_notification” magic function. Once the cell execution is completed, it will send an iMessage to your iPhone indicating whether the job completed successfully or if it failed. If the job failed, it will send error message in the iMessage. You can find a sample notebook of how to use this magic function within the IPython Notebook over here).

%%phone_notification -p 1XXXXXXXXXX -m "Test Job Done"
import time
print "done"

Note that the magic function will only work if you are using MacBook and have an iPhone. However it should be pretty easy to adopt for android ecosystem. I hope you will enjoy the phone notification. Let me know what you think about it.