The PiCloud Notebook is a Python console in your browser optimized for data analysis and collaboration. Unlike a traditional console, a notebook lets you intermingle code and descriptive text. The best way to get a feel for how it works is to see it:
We’re big fans of IPython, and those who are familiar with it will immediately recognize the console as an IPython Notebook running on the PiCloud Platform. While we believe that in general developers will continue to code on their local machine for convenience, there are several advantages to using a cloud-based notebook:
- Your research is accessible from anywhere.
- You can share your work with collaborators.
- You can work efficiently with your data stored on PiCloud or AWS.
- You can get comfortable with the environment your jobs run in.
Log into your account (sign up and get 20 free core hours), and click on the Notebook tab. This brings you to your Notebook Machine.
Think of your Notebook Machine as a computer dedicated to you sitting on the cloud. When you open a notebook, your Notebook Machine is started if it isn’t already. And when you’re done, you should shutdown the machine to avoid wasting resources.
By default, a notebook named “Primer” is available, which will walk you through the examples in the introductory section of our documentation called Primer. Click on it to open your first notebook.
Use your PiCloud account password when prompted.
Using a Notebook
Each box in your notebook is called a cell. Cells can hold code, or various types of markup (Markdown, headers, or raw text). Unlike in a traditional Python console, pressing enter in a cell will create a new line, but not execute it. This makes it easy to write multi-line functions and sequences of commands.
When you want to execute a cell, whether it’s code or markup, press shift+enter. Note the number indicating the order of execution on the left side of the cell, “In [X]“. Unlike a traditional console, you can execute and re-execute a cell at any time, and cells are thus not necessarily in order of execution. While it takes some time to get used to, it’s very handy when you’re continuously iterating your code.
Executing Shell Commands
While the primary use case of the notebook is for writing Python code, it’s also convenient for running shell commands. To execute a shell command, just prefix a command with “!”. For example, you can run “!ls”, “!pwd”, or even the PiCloud command-line interface (CLI), “!picloud”.
Your notebook can also display rich media including images, graphs, videos, and more!
For more tips and tricks, see the following resources:
- PiCloud Notebook Documentation
- IPython Documentation
- IPython Notebook Documentation
- Inside your notebook: Help -> Keyboard shortcuts
What is the Notebook Machine Exactly?
Your Notebook Machine is more than a web application. It’s a full-blown Linux system that can be accessed through the notebook console. We’re able to offer this by leveraging the same job abstraction we’ve already devoted so much effort to. In fact, the machine is running as a job. You can see the job id of your notebook machine from the notebook tab.
How is it Implemented?
As mentioned previously, our notebook is an IPython Notebook running on PiCloud. The notebook is run as a job in your account. For those of you familiar with our platform, you may be wondering how you’re able to connect to the notebook web server running in the job. The answer is that we’ve just released a feature that allows jobs to open listening sockets which can accept external connections. This opens up numerous possibilities including using sockets for job to job communication, as well as hosting web applications.
Using the Notebook to Live the Life of a Job
Another advantage of a notebook is it allows you to explore the system that a job sees. You can do the following:
- Peek around the filesystem.
- Import Python libraries to check availability and version.
- Run non-Python programs.
- Verify that your custom environment is working as expected.
- Verify that your volumes are mounted in the way you intended.
- Benchmark workloads interactively.
Refer to our documentation on configuring your notebook machine for more information regarding mimicking a job’s usage of volumes, environments, multicore, and core types.
If you want to give collaborators access to use your notebook machine, set a secondary password. Then provide the URL of your notebook to your collaborators. They should use the secondary password when prompted. We don’t want you to hand out your primary account password to others.
You can also send a notebook to a collaborator by downloading it (File -> Download as) and manually sending it.
We’re really excited about this latest addition to the PiCloud Platform. If you have any ideas, let us know!
Categories: What's NewYou can follow any responses to this entry through the RSS 2.0 feed.