Skip to main content

A papermill implementation to run notebooks inside dataproc serverless

Project description

Paperless

Made With Love ❤️ from :israel: :israel:

Paperless is a tool that extends the capabilities of Papermill by providing the ability to run Papermill via Google Cloud Dataproc Serverless.

Overview

Papermill is a powerful tool for parameterizing and executing Jupyter Notebooks. However, by default papermill dosn't support Jupyter Kernel Gateway - it was impossible to run spark notebook vs Google Cloud Dataproc Serverless environment with Papermill tool - this is where Paperless helps.

Paperless bridges the gap between Papermill and Google Cloud Dataproc Serverless interactive mode, allowing you to seamlessly integrate the two and harness the power of serverless execution for your Jupyter Notebooks.

Features

  • Serverless Execution: Run Papermill on Google Cloud Dataproc without managing the underlying infrastructure.

  • Scalability: Leverage the scalability of Google Cloud Dataproc for processing multiple Notebooks concurrently.

  • Cost-Effective: Pay only for the resources you consume during the execution, optimizing costs for your notebook parameterization tasks.

Pricing model is much more cost-effective considering other platofrms and technologies

https://cloud.google.com/dataproc-serverless/pricing resource: https://cloud.google.com/dataproc-serverless/pricing

Getting Started

Prerequisites

Before using Paperless, make sure you have the following:

  • A Google Cloud Platform (GCP) project
  • Access to Google Cloud Dataproc Enable the API
  • Papermill installed locally or in your environment

Step 1: Install Google Cloud SDK

To authenticate your application using Application Default Credentials (ADC) with gcloud - If you haven't already installed the Google Cloud SDK, you can download and install it from the Google Cloud SDK documentation.

Step 2: Authenticate with gcloud

Open a terminal and run the following command to authenticate your Google Cloud SDK with your Google Cloud Platform (GCP) account:

gcloud auth login

gcloud auth application-default login 

gcloud config set project <project_id>

gcloud config set compute/region <region>

gcloud config set dataproc/region <region>

Step 3: Install Paperless

pip install paperless

Step 4: Create sessionTemplates For Paperless

Parameters and details can be found in GCP Docs.

The default template name is: paperless-interactive

 gcloud compute instance-templates create paperless-interactive --<extra params...>

You can change parameters as you need based on the jobs needs - check the docs for that.

Step 5: Test Executtion:

Paperless excepts && supports all list or arguments exists in original Papermill package - the minimum needed for testing:

 paperless <input_path> <output_path> ...

An extra environment variable that is special for Paperless: TEMPLATE_NAME=paperless-interactive Example:

 export TEMPLATE_NAME=paperless-interactive && \
     paperless ./resources/spark.ipynb ./resources/spark-out.ipynb

You're all set, enjoy :)


Local development:

# Create a new directory for your project
git clone https://github.com/Plarium-Repo/paperless.git && cd paperless

# Create a virtual environment
python3 -m venv .venv

# Activate the virtual environment
# On Windows
.venv\Scripts\activate

# On macOS and Linux
source venv/bin/activate

# Install requirements
pip install -r requirements.txt

# Install the command line
python setup.py install 

# Execute example
export TEMPLATE_NAME=paperless-interactive && ./.venv/bin/paperless ./tests/resources/test.ipynb ./tests/resources/test-out.ipynb

MIT License

Contribution

Code Of Conduct

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

paperless-1.5.1.tar.gz (11.0 kB view details)

Uploaded Source

Built Distribution

paperless-1.5.1-py3-none-any.whl (11.3 kB view details)

Uploaded Python 3

File details

Details for the file paperless-1.5.1.tar.gz.

File metadata

  • Download URL: paperless-1.5.1.tar.gz
  • Upload date:
  • Size: 11.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.0.0 CPython/3.12.3

File hashes

Hashes for paperless-1.5.1.tar.gz
Algorithm Hash digest
SHA256 1773dbe504a0826dc325ba4bd95282903eac3b17f99384a349c5560d109fcaa4
MD5 e4a95d61ed5e35822961511f42469952
BLAKE2b-256 e8efdc13b0908b9f2c0714aca319f35877f50c51b70560155f4e80db7200d1b6

See more details on using hashes here.

File details

Details for the file paperless-1.5.1-py3-none-any.whl.

File metadata

  • Download URL: paperless-1.5.1-py3-none-any.whl
  • Upload date:
  • Size: 11.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.0.0 CPython/3.12.3

File hashes

Hashes for paperless-1.5.1-py3-none-any.whl
Algorithm Hash digest
SHA256 0c2e75c9903b7b2f1509406c87304274e0309447862ca61f43695e1d4c6c2647
MD5 b6e6dca81eaa13cb3c5afbe436e1bcfe
BLAKE2b-256 4803c53dc71674d7e3a95813bc1570968e668388e7f4200611069ea11b4022f2

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page