Serverless framework

Anyone thought about making Julia available on serverless framework?

https://github.com/serverless/serverless

6 Likes

There’s GitHub - samoconnor/AWSLambda.jl: AWS Lambda interface for Julia but I haven’t used it personally.

Yes, I’m aware of that.

Serverless is an abstraction over any cloud, however. It would also be really nice to get Julia out there from a marketing perspective :wink:

It’s so weird, I was looking for exactly that like 4 days ago. Yea… This would be mighty nice…

1 Like

I am assuming that OpenWhisk, Fn and OpenFaaS project might have a sub-repo, for the Julia’s template. If you are targeting something around standardization - consider this https://cloudevents.io/.

In any case: I wonder if both micro-services and serverless functions could be implemented, auto-tested and deployed during workshops, at the conf:

https://devopsstage.com/

Ivan

I feel some inertia here :blush:

Please vote :slight_smile:

https://feedback.azure.com/forums/355860-azure-functions/suggestions/37558057-julia-lang-support-for-azure-functions

Minor update: it is now possible to create custom function on azure. Though, there are no samples for julia, but only for r and go, it is possible to adapt them for julia. So, it is now possible to build azure serverless with julia.

Here is outline:

Overall process of writing custom azure function described here:
Working with Azure Functions in containers | Microsoft Learn?
tabs=bash%2Cportal&pivots=programming-language-python

Here is example (prototype, proof of concept). We create custom image (based on python image, but it probably could be any, lean base image):

FROM mcr.microsoft.com/azure-functions/python:3.0-python3.9

COPY context/ .

RUN tar zxvf julia-1.6.0-linux-x86_64.tar.gz
ENV PATH="${PATH}:/julia-1.6.0/bin"
RUN julia -e "using Pkg; Pkg.add(\"Genie\")"

#EXPOSE 8080 80
ENV FUNCTIONS_WORKER_RUNTIME_VERSION=1.6

CMD [ "/azure-functions-host/Microsoft.Azure.WebJobs.Script.WebHost" ]

Now, some simple web server (server.jl):

using Genie
import Genie.Router: route
import Genie.Renderer.Json: json

const PORT = parse(Int64, get(ENV, "FUNCTIONS_CUSTOMHANDLER_PORT", "8080"))
Genie.config.run_as_server = true
Genie.config.server_port = PORT

route("/api/order") do
    (:message => "order at api") |> json
end

route("/order") do
    (:message => "just order") |> json
end
Genie.startup()

Config files are all default except for host.json, where we need to start julia with our server:

"customHandler": {
    "description": {
      "defaultExecutablePath": "/julia-1.6.0/bin/julia",
      "workingDirectory": "",
      "arguments": ["server.jl"]
    },
    "enableForwardingHttpRequest": true
  }

This is all. And here is how it looks:

3 Likes

Hello, I managed to get a couple of fairly intensive Azure Function Apps. I created a template for myself that I use to start new projects. This includes

  1. An example on setting up an HTTP endpoint that forwards requests to a storage queue,
  2. A PyCall powered module to access blob storage, (and a safe way to use PyCall while multithreading)
  3. A proven-out path to use PackageCompiler.jl for large projects with a lot of dependencies (such as projects that depend on Flux.jl or DifferentialEquations.jl).

You can access the repo here. I hope this can help out other people trying to deploy Julia code in this manner.