Skip to main content

JupyterLab on Edge

Jupyter notebooks are the most popular environment for exploratory analysis and interactive programming. Edge makes them even more powerful for you. To get started, click on the "Analysis" tile on your Scientific Workbench. Once you are inside the Analysis App, you can work with your Jupyter notebooks just like any other Jupyter or JupyterLab system.

/img/edge_notebook.png

You can launch a "Get Started!" notebook and see a quick demonstration of what you can do in notebooks on Edge:

/img/edge_notebook_get_started.png

Connection to Files on Edge

On the left sidebar of your Analysis App, you will notice that there are two file browsers. One is the built-in local JupyterLab filesystem where you can upload and read data for analysis. This is also where you create and save your notebooks. But there is also a second browser specific to JupyterLab on Edge that points to Files on Edge. This is the shared file space of the Edge organization where you have launched your Analysis App from.

You can move data between your local JupyterLab filesystem and Files on Edge with a simple drag and drop. This works in both directions. If you want to create a local copy of a shared file to analyze and modify it in a notebook; or if you want to share the results of your work in JupyterLab with your team, all you have to do is to drag and drop files between the two file browsers:

/img/edge_drag_and_drop.png

Jupyter notebooks on Edge

On Edge, you also get a predefined object in each notebook, called edge. This object serves as your programmatic access point to the rest of your Edge organization. At any time, you can evaluate edge (run a cell with the edge object by itself) to get an overview of the Edge object and its functionality:

>>> edge
This object serves as your entry point to access data and files in Edge.

You can browse files stored in the Edge internal file
system by using the ".files" attribute. Here's an example:

[1]: edge.files.list()
['myfile.jpg', 'myfile.csv', 'myfolder']

...
>>> type(edge)
edge.edge_session.EdgeSession

The edge object connects you to the rest of the Edge ecosystem. For example, here's how you can list uploaded files and folders in Edge's internal storage:

>>> edge.files.list()
['Example Folder',
'Experiments.txt',
'Imported Data',
'My Data',
'Projects',
'data.csv',
'data_cleaned.csv',
'image001.png',
'image002.png',
'image003.png']

From your edge object, you can also access data from remote data sources:

>>> edge.sources.list()
['data-warehouse-sql', 'petstore-api', 'data-lake-s3']

>>> lake = edge.sources.get('data-lake-s3')
>>> lake.root.list()
['Experiment data', 'SEM micrographs']

>>> lake.root.open('Experiment data').list()
['01f23764ad0b4642a374f68349c5504c.png',
'0a311d9ac6cc4fdb9aace7d927bae892.bin',
'232d50ebf0714315953aa2b0edd0c9f6.bin',
'367581c15fc24175af8fbd78cd13f0fd.png',
'5c622f05c7ec44e1b3749961c2ae56e4.png',
'770a34f466ad4c76bbde849337be48b6.bin',
'92a62cccfcb849b885c29de64114c3ae.bin',
'92da96436830471195a12f56bb4af6c8.png',
'd8d73e96bff44632985ad563eb4397cd.bin',
'dc852dfb0b89442ab918297db9b8d727.png',
'e004927530c74ed7ac8c510744645d55.png',
'e38326ab94494f50ba1050b3ee704eee.bin']

Installing Python packages

A large number of Python packages useful for scientific data analysis are preinstalled. You can also add additional packages using edm (the Enthought Deployment Manager) or pip (the default Python package manager) in a JupyterLab terminal:

$ edm install <package-name>
$ pip install <package-name>
caution

Packages can't be installed into a running Python environment. Before installing packages via edm or pip, be sure to shut down any active kernels. To do this, go to the Kernels menu and select Shut Down All Kernels. Please note that you will lose any in-memory values for your notebooks.

We recommend using the Enthought Deployment Manager (edm) unless the package you want isn't available from Enthought's package repositories. Packages in edm have been extensively tested to make sure they work together. You can read more about EDM in the official EDM docs.

From a notebook tab, you can return to the launcher page using the large blue "+" button at top left (screenshot attached below). From there you can launch new notebooks, terminal windows and more.

/img/edge_analysis_launcher.png

Connecting to Github

If you have a repository hosted on a version control service such as GitHub or GitLab, you can clone it into your workspace by using the built-in git extension.

Clicking on "Git" in the top menu brings up the option to "Clone a Repository", which will then prompt you to enter the GitHub or GitLab repository URI. Be sure it starts with "https://".

Screenshot of the dialogue that opens when you clone a repo. It asks for you to enter the URL.

tip

On GitHub, you can find your repository URI by opening the page for the repository and selecting the blue "< > Code" button. In GitLab, open the repository and look for the blue "Clone" button. You can copy the URI from the box that opens.

caution

If your repository is not publicly accessible, you will see a prompt asking for your credentials to the version control service. For security, it is recommended that you enter a personal access token instead of your password. You can find information on creating a personal access token on the GitHub or GitLab documentation pages.

Dialogue saying to &quot;enter credentials for remote repository&quot;

Resetting Edge

If you get into trouble, shut down any running notebooks and run the reset-edge command from the terminal. This will restore your package set to the "factory default" settings:

$ reset-edge

Resetting Edge will:

* remove all custom Python packages and environments
* restore your Python packages to factory default

You will NOT lose any files or notebooks.

Continue and reset Edge (y/n)?

When you see the prompt above, enter y to confirm the reset. Your packages will be restored to their default settings.

Automatic Shutdown

To preserve compute resources, any running kernel or terminal that is inactive for 30 minutes will be terminated. After that, if the Analysis App detects no activity for 4 hours, it will automatically shut down.