DEV Community

Cover image for Jaf - Deploy Jupyter Notebook as an Azure Function
I love integers
I love integers

Posted on

Jaf - Deploy Jupyter Notebook as an Azure Function

Overview of My Submission

jaf stands for Jupyter notebook as functions.
jaf skaffolds an Azure Duration Function project to enable a jupyter notebook be deployed as a web endpoint.

Jupyter notebooks are widely used as interactive programming environment to experiment data science and machine learning ideas. However, going from development to deployment once a notebook is drafted is extremely hard. The process usually involves an engineer to rewrite significant portion of the jupyter notebook as a web/rpc service in order to make the model/procedure written in the notebook to be callable to other services.

With jaf, you can quickly spin up a web service that makes the jupyter notebook as a callable function, thus expediting greatly the speed to come from dev to deployment for data science solutions.

Submission Category:

Wacky Wildcards

Link to Code on GitHub

GitHub logo yuhuishi-convect / jaf

Jupyter notebook as functions. Project for Azure trial hackathon

jaf


jaf stands for Jupyter notebook as functions. This is a project for Azure trial hackathon.

jaf skaffolds an Azure Duration Function project to enable a jupyter notebook be deployed as a web endpoint.

Usage

Prerequisites

  • Azure cli
  • Azure functions core tools

Skaffold a project

pip install cookiecutter

cookiecutter https://github.com/yuhuishi-convect/jaf

project_name [JupyterAsFunction]: HelloWorld
notebook_url [https://raw.githubusercontent.com/nteract/papermill/main/binder/cli-simple/simple_output.ipynb]: 
Enter fullscreen mode Exit fullscreen mode

Test locally

# start the local runtime

$ func start 
Found Python version 3.8.5 (python3).

Azure Functions Core Tools
Core Tools Version:       4.0.3971 Commit hash: d0775d487c93ebd49e9c1166d5c3c01f3c76eaaf  (64-bit)
Function Runtime Version: 4.0.1.16815


Functions:

        PapermillTrigger: [POST] http://localhost:7071/api/HelloWorld

        PapermillDurableOrc: orchestrationTrigger

        PapermillRunnotebook: activityTrigger

For detailed output, run func with --verbose flag.
info: Microsoft.AspNetCore.Hosting.Diagnostics[1]
      Request starting HTTP/2 POST http://127.0.0.1:46327/AzureFunctionsRpcMessages.FunctionRpc/EventStream application/grpc -
info: Microsoft.AspNetCore.Routing.EndpointMiddleware[0]
      Executing endpoint 'gRPC - /AzureFunctionsRpcMessages.FunctionRpc/EventStream'
[2022-03-07T20:00:52.941Z] Worker process started and initialized.
[2022-03-07T20:00:58.149Z] Host lock lease acquired by instance ID '000000000000000000000000EBCD312A'.
Enter fullscreen mode Exit fullscreen mode
Call the endpoint
# we can specify the parameters in the
Enter fullscreen mode Exit fullscreen mode

Additional Resources / Info

[Note:] # Screenshots/demo videos are encouraged!

Demo video:

<img style="max-width:300px;" src="https://cdn.loom.com/sessions/thumbnails/e26b21e1b5b94e589a274faf77863d4a-with-play.gif">
Enter fullscreen mode Exit fullscreen mode

Top comments (0)