Bacalhau CLI design for multiple language/template frontends and multiple execution backends

June 17, 2022

Context

Following on from the Templating for Bacalhau proposal, which has tons of good examples, and integrating the need to support wasm with a “Python FaaS” style, this document outlines the structure for developing the Bacalhau CLI to support many interfaces and backends.

Problem

We need a way to experiment with various different “frontends” to Bacalhau, e.g. docker, wasm, python, or as fine-grained as Vedant suggests with templates for individual use-cases.

Proposed solution

For a user who is familiar with Docker and has a docker image, running this may seem natural.

bacalhau docker run -v a1b2c3:/data -o output:/output quay.io/lukemarsden/image-segmentation:v0.1

This is because the command is as similar as possible to Docker making It low-friction for a user comfortable with “docker run”.

However for someone with a Python script, the above might look scary whereas, this command below will seem a lot more approachable.

bacalhau run python foo.py -r requirements.txt

We might support python frontends with both docker and wasm backends.

So,

bacalhau run python --backend=wasm foo.py -r requirements.txt

Might be how you ask the python frontend to target a wasm backend.

Or, we might want to try a determinism hint:

bacalhau run python --deterministic foo.py

Or even request verification as a way to trigger determinism:

bacalhau run python --verify foo.py