Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[executor] Update CLI usage for blockless runtime #84

Merged
merged 3 commits into from
May 6, 2023

Conversation

Maelkum
Copy link
Contributor

@Maelkum Maelkum commented Apr 24, 2023

This PR changes the CLI flags passed to the blockless-cli. This obsoletes the need to write the execution manifest to disk prior to executing a request.

At the moment we are not using the --env CLI variable, but instead rely on the approach used so far - to set the environment variables for the runtime and the WASM inherits those. If needed I could change it so that we use --env argument instead.

Example

Given the following runtime config value:

"config": {
      "runtime": {
        "entry": "entry",
        "run_time": 45,
        "limited_fuel": 200,
        "limited_memory": 256,
        "runtime_logger": "runtime.log"
      },
}

This is the produced CLI:

/path/to/runtime/blockless-cli /path/to/whatever.wasm --entry entry --run_time 45 --fs_root_path /path/to/workspace/t/dummy-request-id/fs --limited_fuel 200 --limited_memory 256 --runtime_logger runtime.log -- --function-flag value --function-flag2 value2

Network Example

Test request for illustration purposes, with CLI that are not relevant for the given request:

{
  "function_id": "bafybeicyhzgm7a4b56wvuyp5f7i3hpfktxde7xr73qorykmalz57eeykge",
  "method": "legitimate_gold_mastodon.wasm",
  "parameters": [
    {
      "value": "--file"
    },
    {
      "value": "main.go"
    }
  ],
  "config": {
    "runtime": {
      "run_time": 20,
      "limited_fuel": 1000000000,
      "limited_memory": 256,
      "runtime_logger": "debug.log"
    },
    "permissions": [
      "https://google.com",
      "https://whatever.com"
    ],
    "env_vars": [
      {
        "name": "BLS_REQUEST_PATH",
        "value": "/api"
      }
    ],
    "number_of_nodes": 1,
    "result_aggregation": {
      "enable": false,
      "type": "none",
      "parameters": [
        {
          "name": "type",
          "value": ""
        }
      ]
    }
  }
}

Prepared/executed command, split to newlines for readability:

/app/runtime/blockless-cli \
/app/workspace/bafybeicyhzgm7a4b56wvuyp5f7i3hpfktxde7xr73qorykmalz57eeykge/legitimate_gold_mastodon.wasm \
--run-time 20 \
--fs-root-path /app/workspace/t/add4687b-8625-40fe-9bf8-6ddeed92b8d1/fs \
--limited-fuel 1000000000 \
--limited-memory 256 \
--runtime-logger debug.log \
--permission https://google.com \
--permission https://whatever.com \
-- \
--file main.go

@Maelkum Maelkum self-assigned this Apr 24, 2023
@Maelkum Maelkum force-pushed the executor-use-cli-flags-no-manifest branch from 505642e to 986cd10 Compare April 28, 2023 16:07
@Maelkum Maelkum marked this pull request as ready for review April 28, 2023 16:19
@Maelkum Maelkum requested a review from dmikey April 28, 2023 16:19
@dmikey
Copy link
Contributor

dmikey commented May 4, 2023

thoughts on flags for the runtime? did you see my comments to @Joinhack about using - vs _. And the work there has been completed, does it all match?

@Maelkum
Copy link
Contributor Author

Maelkum commented May 5, 2023

@dmikey Yup, everything should match..

Here are the relevant runtime flag definitions and here are the definitions used in the b7s code.

Two notes right now:

  • we don't use the env flag right now but use the "old" way to set environment variables
  • we don't support the module flag

If it's clarified how modules are specified in the execution request I can add that too, or add it in a separate PR.

Overall, I like the change as it's much cleaner approach and simplifies the executor.

@dmikey dmikey merged commit d49ef0f into main May 6, 2023
@dmikey dmikey deleted the executor-use-cli-flags-no-manifest branch May 6, 2023 00:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants