Jupyter Magics for EMR Notebooks.
Slowing down. Last release over 3 years ago, little activity since. Fine for existing code; think twice for a new project.
pip install emr-notebooks-magicsEMR Notebooks iPython Magics
This repository contains iPython magics that can be used in Amazon EMR Notebooks.
Table of Contents
Installation
Installing Dependencies
%mount_workspace_dir magic mounts the Workspace using S3-FUSE or Goofys.
-
Installing S3-FUSE
Add the following lines to your cluster bootstrap action script.
#!/bin/sh sudo amazon-linux-extras install epel -y sudo yum install s3fs-fuse -y -
Installing Goofys
Add the following lines to your cluster bootstrap action script.
#!/bin/sh sudo wget https://github.com/kahing/goofys/releases/latest/download/goofys -P /usr/bin/ sudo chmod ugo+x /usr/bin/goofys
Installing iPython magics
-
Using EMR Step.
EMR step script
#!/bin/sh sudo -u emr-notebook /mnt/notebook-env/bin/pip install emr-notebooks-magics -
From Jupyter Notebook
%pip install emr-notebooks-magics
The magics are loaded using kernel startup script. If you install magics from Jupyter Notebook, you will need to restart the kernel before using the magic.
Note: EMR-notebook-magics cannot be installed through bootstrap actions as JEG and Notebook environments are installed after the bootstrap.
Usage
-
%generate_s3_download_urlmagic generates presigned url for S3 objects so that it can be downloaded from the Jupyter Notebook. Refer%generate_s3_download_url?for help.-
Generate download url for a S3 object specifying full S3 path.
%generate_s3_download_url s3://my_bucket/path/to/s3/object -
Generate download url for a file in the Workspace specifying path relative to Workspace root.
%generate_s3_download_url relative/path/to/workspace/file
-