mirror of
https://github.com/fluencelabs/aquavm
synced 2024-12-04 07:10:18 +00:00
feat(tools): merge some tools into the air
CLI tool (#509)
* feat(tools): merge some tools into the `air` CLI tool `air-beautify` and `air-trace` are merged into a single `air` tool. Its crate name is `fluence-air-cli` as otherwise it confilicts with `air` interpreter crate. The tool has subcommands `beautify`, `run` and `stats`. * Add one-letter aliases to `air` CLI subcommands + `air beautify` => `air b` + `air run` => `air r` + `air stats` => `air s` --------- Co-authored-by: Mike Voronov <michail.vms@gmail.com>
This commit is contained in:
parent
790d3c2119
commit
79ac153f1d
5
.github/release-please/config.json
vendored
5
.github/release-please/config.json
vendored
@ -48,10 +48,7 @@
|
||||
},
|
||||
"crates/data-store": {},
|
||||
"crates/testing-framework": {},
|
||||
"tools/cli/air-beautify": {
|
||||
"component": "air-beautify"
|
||||
},
|
||||
"tools/cli/air-trace": {},
|
||||
"tools/cli/aquavm-air-cli": {},
|
||||
"tools/wasm/air-beautify-wasm": {
|
||||
"component": "air-beautify-wasm"
|
||||
}
|
||||
|
3
.github/release-please/manifest.json
vendored
3
.github/release-please/manifest.json
vendored
@ -14,7 +14,6 @@
|
||||
"crates/beautifier": "0.1.1",
|
||||
"crates/data-store": "0.6.0",
|
||||
"crates/testing-framework": "0.1.5",
|
||||
"tools/cli/air-beautify": "0.1.1",
|
||||
"tools/cli/air-trace": "0.2.6",
|
||||
"tools/cli/aquavm-air-cli": "0.2.6",
|
||||
"tools/wasm/air-beautify-wasm": "0.1.0"
|
||||
}
|
||||
|
4
.github/workflows/ci.yml
vendored
4
.github/workflows/ci.yml
vendored
@ -105,8 +105,8 @@ jobs:
|
||||
- name: Run cargo check
|
||||
run: cargo check
|
||||
|
||||
- name: Check native air-trace
|
||||
run: cargo check --package air-trace --no-default-features
|
||||
- name: Check native aquavm-air-cli
|
||||
run: cargo check --package aquavm-air-cli --no-default-features
|
||||
|
||||
- name: Run cargo clippy
|
||||
run: cargo clippy -v
|
||||
|
180
Cargo.lock
generated
180
Cargo.lock
generated
@ -11,63 +11,15 @@ dependencies = [
|
||||
"memchr",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "air"
|
||||
version = "0.37.0"
|
||||
dependencies = [
|
||||
"air-execution-info-collector",
|
||||
"air-interpreter-cid",
|
||||
"air-interpreter-data",
|
||||
"air-interpreter-interface",
|
||||
"air-lambda-ast",
|
||||
"air-lambda-parser",
|
||||
"air-log-targets",
|
||||
"air-parser",
|
||||
"air-test-utils",
|
||||
"air-testing-framework",
|
||||
"air-trace-handler",
|
||||
"air-utils",
|
||||
"boolinator",
|
||||
"concat-idents",
|
||||
"criterion 0.3.6",
|
||||
"csv",
|
||||
"env_logger",
|
||||
"fluence-app-service",
|
||||
"fstrings",
|
||||
"log",
|
||||
"maplit",
|
||||
"marine-rs-sdk",
|
||||
"non-empty-vec",
|
||||
"once_cell",
|
||||
"polyplets",
|
||||
"pretty_assertions 0.6.1",
|
||||
"semver 1.0.17",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"strum",
|
||||
"strum_macros",
|
||||
"thiserror",
|
||||
"tracing",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "air-beautifier"
|
||||
version = "0.1.2"
|
||||
dependencies = [
|
||||
"air-parser",
|
||||
"aquavm-air-parser",
|
||||
"itertools",
|
||||
"thiserror",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "air-beautify"
|
||||
version = "0.1.2"
|
||||
dependencies = [
|
||||
"air-beautifier",
|
||||
"anyhow",
|
||||
"clap 4.1.8",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "air-beautify-wasm"
|
||||
version = "0.1.1"
|
||||
@ -80,16 +32,16 @@ dependencies = [
|
||||
name = "air-execution-info-collector"
|
||||
version = "0.7.3"
|
||||
dependencies = [
|
||||
"air-parser",
|
||||
"aquavm-air-parser",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "air-interpreter"
|
||||
version = "0.37.0"
|
||||
dependencies = [
|
||||
"air",
|
||||
"air-interpreter-interface",
|
||||
"air-log-targets",
|
||||
"aquavm-air",
|
||||
"log",
|
||||
"marine-rs-sdk",
|
||||
"serde",
|
||||
@ -115,8 +67,8 @@ version = "0.6.3"
|
||||
dependencies = [
|
||||
"air-interpreter-cid",
|
||||
"air-interpreter-interface",
|
||||
"air-parser",
|
||||
"air-utils",
|
||||
"aquavm-air-parser",
|
||||
"once_cell",
|
||||
"polyplets",
|
||||
"semver 1.0.17",
|
||||
@ -166,36 +118,14 @@ dependencies = [
|
||||
name = "air-log-targets"
|
||||
version = "0.1.0"
|
||||
|
||||
[[package]]
|
||||
name = "air-parser"
|
||||
version = "0.7.3"
|
||||
dependencies = [
|
||||
"air-lambda-ast",
|
||||
"air-lambda-parser",
|
||||
"codespan",
|
||||
"codespan-reporting",
|
||||
"criterion 0.4.0",
|
||||
"fstrings",
|
||||
"itertools",
|
||||
"lalrpop",
|
||||
"lalrpop-util",
|
||||
"multimap",
|
||||
"non-empty-vec",
|
||||
"regex",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"thiserror",
|
||||
"tracing",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "air-test-utils"
|
||||
version = "0.4.5"
|
||||
dependencies = [
|
||||
"air",
|
||||
"air-interpreter-cid",
|
||||
"air-interpreter-data",
|
||||
"air-interpreter-interface",
|
||||
"aquavm-air",
|
||||
"avm-interface",
|
||||
"avm-server",
|
||||
"fstrings",
|
||||
@ -212,8 +142,8 @@ dependencies = [
|
||||
name = "air-testing-framework"
|
||||
version = "0.1.5"
|
||||
dependencies = [
|
||||
"air-parser",
|
||||
"air-test-utils",
|
||||
"aquavm-air-parser",
|
||||
"itertools",
|
||||
"maplit",
|
||||
"nom 7.1.3",
|
||||
@ -223,23 +153,6 @@ dependencies = [
|
||||
"strum",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "air-trace"
|
||||
version = "0.2.6"
|
||||
dependencies = [
|
||||
"air",
|
||||
"air-interpreter-interface",
|
||||
"air-test-utils",
|
||||
"anyhow",
|
||||
"avm-data-store",
|
||||
"avm-interface",
|
||||
"clap 4.1.8",
|
||||
"itertools",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"tracing-subscriber",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "air-trace-handler"
|
||||
version = "0.1.2"
|
||||
@ -248,7 +161,7 @@ dependencies = [
|
||||
"air-interpreter-data",
|
||||
"air-interpreter-interface",
|
||||
"air-log-targets",
|
||||
"air-parser",
|
||||
"aquavm-air-parser",
|
||||
"bimap",
|
||||
"log",
|
||||
"polyplets",
|
||||
@ -291,6 +204,85 @@ version = "1.0.69"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "224afbd727c3d6e4b90103ece64b8d1b67fbb1973b1046c2281eed3f3803f800"
|
||||
|
||||
[[package]]
|
||||
name = "aquavm-air"
|
||||
version = "0.37.0"
|
||||
dependencies = [
|
||||
"air-execution-info-collector",
|
||||
"air-interpreter-cid",
|
||||
"air-interpreter-data",
|
||||
"air-interpreter-interface",
|
||||
"air-lambda-ast",
|
||||
"air-lambda-parser",
|
||||
"air-log-targets",
|
||||
"air-test-utils",
|
||||
"air-testing-framework",
|
||||
"air-trace-handler",
|
||||
"air-utils",
|
||||
"aquavm-air-parser",
|
||||
"boolinator",
|
||||
"concat-idents",
|
||||
"criterion 0.3.6",
|
||||
"csv",
|
||||
"env_logger",
|
||||
"fluence-app-service",
|
||||
"fstrings",
|
||||
"log",
|
||||
"maplit",
|
||||
"marine-rs-sdk",
|
||||
"non-empty-vec",
|
||||
"once_cell",
|
||||
"polyplets",
|
||||
"pretty_assertions 0.6.1",
|
||||
"semver 1.0.17",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"strum",
|
||||
"strum_macros",
|
||||
"thiserror",
|
||||
"tracing",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "aquavm-air-cli"
|
||||
version = "0.2.6"
|
||||
dependencies = [
|
||||
"air-beautifier",
|
||||
"air-interpreter-interface",
|
||||
"air-test-utils",
|
||||
"anyhow",
|
||||
"aquavm-air",
|
||||
"avm-data-store",
|
||||
"avm-interface",
|
||||
"clap 4.1.8",
|
||||
"itertools",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"tracing-subscriber",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "aquavm-air-parser"
|
||||
version = "0.7.3"
|
||||
dependencies = [
|
||||
"air-lambda-ast",
|
||||
"air-lambda-parser",
|
||||
"codespan",
|
||||
"codespan-reporting",
|
||||
"criterion 0.4.0",
|
||||
"fstrings",
|
||||
"itertools",
|
||||
"lalrpop",
|
||||
"lalrpop-util",
|
||||
"multimap",
|
||||
"non-empty-vec",
|
||||
"regex",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"thiserror",
|
||||
"tracing",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "arrayref"
|
||||
version = "0.3.6"
|
||||
|
@ -19,8 +19,7 @@ members = [
|
||||
"crates/beautifier",
|
||||
"crates/data-store",
|
||||
"crates/testing-framework",
|
||||
"tools/cli/air-beautify",
|
||||
"tools/cli/air-trace",
|
||||
"tools/cli/air",
|
||||
"tools/wasm/air-beautify-wasm",
|
||||
]
|
||||
|
||||
|
@ -18,7 +18,7 @@ name = "air_interpreter_server"
|
||||
path = "src/marine.rs"
|
||||
|
||||
[dependencies]
|
||||
air = { version = "0.37.0", path = "../air" }
|
||||
aquavm-air = { version = "0.37.0", path = "../air" }
|
||||
air-interpreter-interface = { version = "0.12.1", path = "../crates/air-lib/interpreter-interface" }
|
||||
air-log-targets = { version = "0.1.0", path = "../crates/air-lib/log-targets" }
|
||||
|
||||
|
@ -1,11 +1,11 @@
|
||||
[package]
|
||||
name = "air"
|
||||
name = "aquavm-air"
|
||||
version = "0.37.0"
|
||||
description = "Interpreter of AIR scripts intended to coordinate request flow in the Fluence network"
|
||||
authors = ["Fluence Labs"]
|
||||
edition = "2018"
|
||||
repository = "https://github.com/fluencelabs/aquavm"
|
||||
publish = false
|
||||
documentation = "https://docs.rs/aquavm-air"
|
||||
keywords = ["fluence", "air", "webassembly", "programming-language"]
|
||||
categories = ["wasm"]
|
||||
|
||||
@ -15,7 +15,7 @@ path = "src/lib.rs"
|
||||
doctest = false
|
||||
|
||||
[dependencies]
|
||||
air-parser = { version = "0.7.2", path = "../crates/air-lib/air-parser" }
|
||||
aquavm-air-parser = { version = "0.7.2", path = "../crates/air-lib/air-parser" }
|
||||
air-execution-info-collector = { version = "0.7.2", path = "../crates/air-lib/execution-info-collector" }
|
||||
air-interpreter-cid = { version = "0.2.0", path = "../crates/air-lib/interpreter-cid" }
|
||||
air-interpreter-data = { version = "0.6.2", path = "../crates/air-lib/interpreter-data" }
|
||||
|
@ -9,7 +9,7 @@ name = "auth_module"
|
||||
path = "src/main.rs"
|
||||
|
||||
[dependencies]
|
||||
air = { path = "../../../../../../../air" }
|
||||
aquavm-air = { path = "../../../../../../../air" }
|
||||
marine-rs-sdk = "0.7.0"
|
||||
|
||||
[workspace]
|
||||
|
@ -9,7 +9,7 @@ name = "log_storage"
|
||||
path = "src/main.rs"
|
||||
|
||||
[dependencies]
|
||||
air = { path = "../../../../../../../air" }
|
||||
aquavm-air = { path = "../../../../../../../air" }
|
||||
marine-rs-sdk = "0.7.0"
|
||||
|
||||
[workspace]
|
||||
|
@ -5,7 +5,7 @@ set -o pipefail -e
|
||||
# Its dependencies:
|
||||
# + jq utility
|
||||
# + compiled AquaVM WASM binary
|
||||
# + installed air-trace
|
||||
# + installed air
|
||||
|
||||
function trace_len {
|
||||
jq '.trace | length'
|
||||
@ -37,7 +37,7 @@ function error {
|
||||
function main {
|
||||
if [ "$#" \< 2 ]; then
|
||||
if [ x"$1" == x"--help" ]; then
|
||||
error "usage: $0 (--all|big|long) (--all|merge|nomerge) [ air-trace run args ... ]"
|
||||
error "usage: $0 (--all|big|long) (--all|merge|nomerge) [ air run args ... ]"
|
||||
else
|
||||
error "Provide at least two arguments: (--all|big|long) and (--all|merge|nomerge)"
|
||||
fi
|
||||
@ -113,7 +113,7 @@ function main {
|
||||
echo >&1
|
||||
echo "*** Running test ${tst}-${subt}..." >&1
|
||||
eval "${script_cmd}" | \
|
||||
air-trace run "$@" --repeat 1 --plain \
|
||||
air run "$@" --repeat 1 --plain \
|
||||
--prev-data "$prev_data_path" \
|
||||
--data "$current_data_path"
|
||||
done
|
||||
|
@ -1,14 +1,19 @@
|
||||
[package]
|
||||
name = "air-parser"
|
||||
name = "aquavm-air-parser"
|
||||
description = "Parser of the AIR scripts in a form of string to AST"
|
||||
version = "0.7.3"
|
||||
authors = ["Fluence Labs"]
|
||||
edition = "2018"
|
||||
license = "Apache-2.0"
|
||||
publish = false
|
||||
documentation = "https://docs.rs/air-parser"
|
||||
repository = "https://github.com/fluencelabs/aquavm"
|
||||
keywords = ["fluence", "air", "parser", "lalrpop"]
|
||||
categories = ["wasm"]
|
||||
|
||||
[lib]
|
||||
name = "air_parser"
|
||||
path = "src/lib.rs"
|
||||
|
||||
[build-dependencies]
|
||||
lalrpop = "0.19.8"
|
||||
|
||||
|
@ -5,7 +5,8 @@ description = "Implementation of AIR execution info collector"
|
||||
authors = ["Fluence Labs"]
|
||||
edition = "2018"
|
||||
license = "Apache-2.0"
|
||||
publish = false
|
||||
repository = "https://github.com/fluencelabs/aquavm"
|
||||
documentation = "https://docs.rs/air-execution-info-collector"
|
||||
keywords = ["fluence", "air", "webassembly", "programming-language"]
|
||||
categories = ["wasm"]
|
||||
|
||||
@ -14,4 +15,4 @@ name = "air_execution_info_collector"
|
||||
path = "src/lib.rs"
|
||||
|
||||
[dependencies]
|
||||
air-parser = { path = "../air-parser" }
|
||||
aquavm-air-parser = { path = "../air-parser" }
|
||||
|
@ -5,7 +5,8 @@ version = "0.6.3"
|
||||
authors = ["Fluence Labs"]
|
||||
edition = "2018"
|
||||
license = "Apache-2.0"
|
||||
publish = false
|
||||
repository = "https://github.com/fluencelabs/aquavm"
|
||||
documentation = "https://docs.rs/air-interpreter-data"
|
||||
keywords = ["fluence", "air", "webassembly", "programming-language"]
|
||||
categories = ["wasm"]
|
||||
|
||||
@ -15,7 +16,7 @@ path = "src/lib.rs"
|
||||
|
||||
[dependencies]
|
||||
air-utils = { version = "0.1.0", path = "../utils" }
|
||||
air-parser = { version = "0.7.3", path = "../air-parser" }
|
||||
aquavm-air-parser = { version = "0.7.3", path = "../air-parser" }
|
||||
air-interpreter-interface = { version = "0.12.1", path = "../interpreter-interface" }
|
||||
air-interpreter-cid = { version = "0.2.0", path = "../interpreter-cid" }
|
||||
polyplets = { version = "0.3.2", path = "../polyplets" }
|
||||
|
@ -5,7 +5,8 @@ version = "0.1.0"
|
||||
authors = ["Fluence Labs"]
|
||||
edition = "2018"
|
||||
license = "Apache-2.0"
|
||||
publish = false
|
||||
repository = "https://github.com/fluencelabs/aquavm"
|
||||
documentation = "https://docs.rs/air-lambda-ast"
|
||||
keywords = ["fluence", "air", "lambda", "ast"]
|
||||
categories = ["wasm"]
|
||||
|
||||
|
@ -5,7 +5,8 @@ version = "0.1.0"
|
||||
authors = ["Fluence Labs"]
|
||||
edition = "2018"
|
||||
license = "Apache-2.0"
|
||||
publish = false
|
||||
repository = "https://github.com/fluencelabs/aquavm"
|
||||
documentation = "https://docs.rs/air-lambda-parser"
|
||||
keywords = ["fluence", "air", "parser", "lalrpop"]
|
||||
categories = ["wasm"]
|
||||
|
||||
|
@ -5,7 +5,8 @@ description = "Definition of global consts used for logging"
|
||||
authors = ["Fluence Labs"]
|
||||
edition = "2018"
|
||||
license = "Apache-2.0"
|
||||
publish = false
|
||||
repository = "https://github.com/fluencelabs/aquavm"
|
||||
documentation = "https://docs.rs/air-log-targets"
|
||||
keywords = ["fluence", "air", "webassembly", "programming-language"]
|
||||
categories = ["wasm"]
|
||||
|
||||
|
@ -5,7 +5,8 @@ description = "Test utils for the AIR interpreter"
|
||||
authors = ["Fluence Labs"]
|
||||
edition = "2018"
|
||||
license = "Apache-2.0"
|
||||
publish = false
|
||||
repository = "https://github.com/fluencelabs/aquavm"
|
||||
documentation = "https://docs.rs/air-test-utils"
|
||||
keywords = ["fluence", "air", "webassembly", "security", "authorization"]
|
||||
categories = ["wasm"]
|
||||
|
||||
@ -14,7 +15,7 @@ name = "air_test_utils"
|
||||
path = "src/lib.rs"
|
||||
|
||||
[dependencies]
|
||||
air = { path = "../../../air" }
|
||||
aquavm-air = { path = "../../../air" }
|
||||
air-interpreter-cid = { version = "0.2.0", path = "../interpreter-cid" }
|
||||
air-interpreter-data = { version = "0.6.3", path = "../interpreter-data" }
|
||||
air-interpreter-interface = { version = "0.12.1", path = "../interpreter-interface" }
|
||||
|
@ -18,7 +18,7 @@ air-interpreter-cid = { version = "0.2.0", path = "../interpreter-cid" }
|
||||
air-interpreter-data = { version = "0.6.3", path = "../interpreter-data" }
|
||||
air-interpreter-interface = { version = "0.12.1", path = "../interpreter-interface" }
|
||||
air-log-targets = { version = "0.1.0", path = "../log-targets" }
|
||||
air-parser = { version = "0.7.3", path = "../air-parser" }
|
||||
aquavm-air-parser = { version = "0.7.3", path = "../air-parser" }
|
||||
polyplets = { version = "0.3.2", path = "../polyplets" }
|
||||
|
||||
bimap = "0.6.2"
|
||||
|
@ -5,8 +5,8 @@ description = "AIR human-readable format transformer library"
|
||||
authors = ["Fluence Labs"]
|
||||
edition = "2018"
|
||||
license = "Apache-2.0"
|
||||
repository = "https://github.com/fluencelabs/aquavm/tree/master/crates/beautifier"
|
||||
publish = false
|
||||
repository = "https://github.com/fluencelabs/aquavm"
|
||||
documentation = "https://docs.rs/air-beautifier"
|
||||
keywords = ["fluence", "air", "beautifier"]
|
||||
|
||||
[lib]
|
||||
@ -14,6 +14,6 @@ name = "air_beautifier"
|
||||
path = "src/lib.rs"
|
||||
|
||||
[dependencies]
|
||||
air-parser = { version = "0.7.3", path = "../air-lib/air-parser" }
|
||||
aquavm-air-parser = { version = "0.7.3", path = "../air-lib/air-parser" }
|
||||
itertools = "0.10.5"
|
||||
thiserror = "1.0.39"
|
||||
|
@ -15,7 +15,7 @@ path = "src/lib.rs"
|
||||
|
||||
[dependencies]
|
||||
air-test-utils = { version = "0.4.5", path = "../air-lib/test-utils" }
|
||||
air-parser = { version = "0.7.3", path = "../air-lib/air-parser" }
|
||||
aquavm-air-parser = { version = "0.7.3", path = "../air-lib/air-parser" }
|
||||
|
||||
itertools = "0.10.5"
|
||||
strum = { version="0.24.1", features=["derive"] }
|
||||
|
@ -1,14 +0,0 @@
|
||||
[package]
|
||||
name = "air-beautify"
|
||||
version = "0.1.2"
|
||||
edition = "2021"
|
||||
description = "AIR human-readable format transformer binary"
|
||||
authors = ["Fluence Labs"]
|
||||
license = "Apache-2.0"
|
||||
publish = false
|
||||
keywords = ["fluence", "air", "beautifier"]
|
||||
|
||||
[dependencies]
|
||||
air-beautifier = { version = "0.1.2", path = "../../../crates/beautifier" }
|
||||
clap = { version = "4.1.8", features = ["derive"] }
|
||||
anyhow = "1.0.69"
|
@ -1,19 +1,21 @@
|
||||
[package]
|
||||
name = "air-trace"
|
||||
name = "aquavm-air-cli"
|
||||
version = "0.2.6"
|
||||
edition = "2021"
|
||||
description = "AIR performance tracing tool"
|
||||
description = "AIR execution and printing tool"
|
||||
authors = ["Fluence Labs"]
|
||||
license = "Apache-2.0"
|
||||
publish = false
|
||||
repository = "https://github.com/fluencelabs/aquavm"
|
||||
documentation = "https://docs.rs/aquavm-air-cli"
|
||||
keywords = ["fluence", "air", "tracing"]
|
||||
|
||||
[dependencies]
|
||||
air = { version = "0.37.0", path = "../../../air" }
|
||||
air-test-utils = { version = "0.4.5",path = "../../../crates/air-lib/test-utils", optional = true }
|
||||
air-interpreter-interface = { version = "0.12.1", path = "../../../crates/air-lib/interpreter-interface", default-features = false }
|
||||
aquavm-air = { version = "0.37.0", path = "../../../air" }
|
||||
air-beautifier = { version = "0.1.2", path = "../../../crates/beautifier" }
|
||||
avm-data-store = { version = "0.6.0", path = "../../../crates/data-store" }
|
||||
avm-interface = { version = "0.28.2", path = "../../../avm/interface" }
|
||||
air-interpreter-interface = { version = "0.12.1", path = "../../../crates/air-lib/interpreter-interface", default-features = false }
|
||||
air-test-utils = { version = "0.4.4",path = "../../../crates/air-lib/test-utils", optional = true }
|
||||
|
||||
anyhow = "1.0.69"
|
||||
clap = { version = "4.1.8", features = ["derive", "env"] }
|
||||
@ -25,3 +27,7 @@ tracing-subscriber = { version = "0.3.16", default-features = false, features =
|
||||
[features]
|
||||
default = ["wasm"]
|
||||
wasm = ["air-test-utils"]
|
||||
|
||||
[[bin]]
|
||||
name = "air"
|
||||
path = "src/main.rs"
|
@ -1,8 +1,18 @@
|
||||
# The `air-trace` utility
|
||||
# The `air` CLI utility
|
||||
|
||||
The main propose of this utility is to run AquaVM with data and analyze its performance. It has two subcommands: `run` and `stats`.
|
||||
The `air` CLI utility is a helper tool for Aqua and AIR developers. It has three subcommands: `beautify`, `run` and `stats`.
|
||||
|
||||
## `air-trace run`
|
||||
## `air beautify`
|
||||
|
||||
Alias: `air b`.
|
||||
|
||||
This subcommand reads an AIR script from standard input and prints it in human-readable Python-like representation. This representation cannot be executed and is intended to be read by mere mortals.
|
||||
|
||||
It outputs to standard output or a file.
|
||||
|
||||
## `air run`
|
||||
|
||||
Alias: `air r`.
|
||||
|
||||
Executes an AIR script with data in WASM AquaVM. It has two modes of parameter input: plain and anomaly.
|
||||
|
||||
@ -12,27 +22,29 @@ All common parameters are optional. Their position is before the mode selector
|
||||
+ `--call-results PATH` parameter allows you to provide call results for current execution.
|
||||
+ `--max-heap-size N` defines maximum heap size for WASM runtime.
|
||||
+ `--interpreter PATH` option defines the AquaVM WASM binary to be executed. By default, it is "target/wasm32-wasi/release/air_interpreter_server.wasm", but you can define a global value with the `AIR_INTERPRETER_WASM_PATH` environment variable. The default presumes that the tool is run from the root of this repository. Feel free to use option or environment variable to run from any location.
|
||||
+ with the `--json` option, tracing info is output (to stderr) in machine-readable JSON format. The output can be later processed with `air-trace stats` subcommand.
|
||||
+ with the `--json` option, tracing info is output (to stderr) in machine-readable JSON format. The output can be later processed with `air stats` subcommand.
|
||||
+ `--tracing-params` defines tracing logging levels for AquaVM. By default, it is equal to `info` and does trace the most high-level AquaVM constructions (data parsing, AIR script parsing, execution). With `debug` level it traces some individual commands, and with `trace` level it traces even more fine grained functionality, but it induce more overhead.
|
||||
+ `--runner-tracing-params` defines tracing logging level for the runner. By default, it is equal to `warn`.
|
||||
|
||||
The important option is `--native`. It runs the AquaVM as the native code that can be profiled with any native profiler. As input data deserialization and serialization time can be comparable to particle execution time, and short execution times provides less reliable results, one can use `--repeat N` option to repeat particle execution several times. Execution result is not printed in this case, so you may run `--repeat 1` to suppress it.
|
||||
|
||||
Run `air-trace run --help` to see all common parameters.
|
||||
Run `air run --help` to see all common parameters.
|
||||
|
||||
### Plain mode
|
||||
In the `--plain` mode, the parameters like AIR script path, data path, previous data path and other particle fields can be provided in separate arguments, of which only `--data` is the required one (and AIR script is read from stdin by default).
|
||||
|
||||
Run `air-trace run --plain --help` to see all plain mode options.
|
||||
Run `air run --plain --help` to see all plain mode options.
|
||||
|
||||
### Anomaly mode
|
||||
In the anomaly mode, the only argument is a path to self-contained anomaly data file obtained from Anomaly Particle Detection System.
|
||||
In the anomaly mode, the only argument is a path to self-contained anomaly data file obtained from `rust-peer`'s Anomaly Particle Detection System.
|
||||
|
||||
Run `air-trace run --anomaly --help` to see all anomaly mode options.
|
||||
Run `air run --anomaly --help` to see all anomaly mode options.
|
||||
|
||||
## `air-trace stats`
|
||||
## `air stats`
|
||||
|
||||
This subcommand allows to process JSON trace collected with `air-trace run --json`. It has two primary options:
|
||||
Alias: `air s`.
|
||||
|
||||
This subcommand allows to process JSON trace collected with `air run --json`. It has two primary options:
|
||||
|
||||
+ `--pretty` outputs JSON trace in human readable format.
|
||||
+ `--stats` outputs execution summary.
|
||||
@ -41,7 +53,7 @@ By default, both options are effective.
|
||||
|
||||
The `--sort-stats-by-duration` flag sorts spans by time, not by name, in the report.
|
||||
|
||||
Please, note that currently tracing outputs to stdout, and execution result is also printed to stdout. You may suppress printing the result with `air-trace run --repeat 1` option.
|
||||
Please, note that currently tracing outputs to stdout, and execution result is also printed to stdout. You may suppress printing the result with `air run --repeat 1` option.
|
||||
|
||||
## Known limitations
|
||||
|
||||
@ -49,7 +61,7 @@ Please, note that currently tracing outputs to stdout, and execution result is a
|
||||
|
||||
## Installation
|
||||
|
||||
### AIR interpreter server
|
||||
### AIR interpreter
|
||||
|
||||
You need the `marine` tool installed. Run following command in the repo's root directory:
|
||||
|
||||
@ -57,23 +69,23 @@ You need the `marine` tool installed. Run following command in the repo's root
|
||||
marine build --features marine --package air-interpreter --release
|
||||
```
|
||||
|
||||
It will output the binary to default `--interpreter` path at `target/wasm32-wasi/release/air_interpreter_server.wasm`; if you wish to run the `air-trace` from arbitrary place, store the `air_interpreter_server.wasm` binary in a cool dry place and set `AIR_INTERPRETER_WASM_PATH` variable.
|
||||
It will output the binary to default `--interpreter` path at `target/wasm32-wasi/release/air_interpreter_server.wasm`; if you wish to run the `air` from arbitrary place, store the `air_interpreter_server.wasm` binary in a cool dry place and set `AIR_INTERPRETER_WASM_PATH` variable.
|
||||
|
||||
## `air-trace` binary
|
||||
## `air` binary
|
||||
|
||||
You need to have Rust toolchain and its `cargo` utility installed. Run this command from the repo's root directory:
|
||||
|
||||
``` sh
|
||||
cargo install --path tools/cli/air-trace
|
||||
cargo install --path tools/cli/air
|
||||
```
|
||||
|
||||
## `air-trace` native build
|
||||
## `air` CLI native build
|
||||
|
||||
You can have fully native or WASM `air-trace` build with the following commands:
|
||||
You can have fully native or pure WASM `air` CLI build with the following commands:
|
||||
|
||||
``` sh
|
||||
cargo build --no-default-features --release -p air-trace
|
||||
cargo build --no-default-features --release -p air-trace --target wasm32-wasi
|
||||
cargo build --no-default-features --release -p aquavm-air-cli
|
||||
cargo build --no-default-features --release -p aquavm-air-cli --target wasm32-wasi
|
||||
```
|
||||
|
||||
This build doesn't need the AIR interpreter server binary.
|
||||
This build doesn't need the AIR interpreter WASM binary.
|
@ -14,18 +14,6 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#![forbid(unsafe_code)]
|
||||
#![warn(rust_2018_idioms)]
|
||||
#![deny(
|
||||
dead_code,
|
||||
nonstandard_style,
|
||||
unused_imports,
|
||||
unused_mut,
|
||||
unused_variables,
|
||||
unused_unsafe,
|
||||
unreachable_patterns
|
||||
)]
|
||||
|
||||
use air_beautifier::Beautifier;
|
||||
use anyhow::{Context, Result};
|
||||
use clap::Parser;
|
||||
@ -33,7 +21,8 @@ use clap::Parser;
|
||||
use std::{io, path::PathBuf};
|
||||
|
||||
#[derive(Parser)]
|
||||
struct Args {
|
||||
#[clap(about = "Pretty-print an AIR script to Python-like representation")]
|
||||
pub(crate) struct Args {
|
||||
#[clap(short, long, default_value_t = air_beautifier::DEFAULT_INDENT_STEP)]
|
||||
indent_step: usize,
|
||||
#[clap(short, long)]
|
||||
@ -72,8 +61,7 @@ fn build_output(args: &Args) -> Result<Box<dyn io::Write>> {
|
||||
Ok(output)
|
||||
}
|
||||
|
||||
fn main() -> Result<()> {
|
||||
let args = Args::parse();
|
||||
pub(crate) fn beautify(args: Args) -> Result<()> {
|
||||
let air_script = read_script(&args).context("failed to read the input")?;
|
||||
let output = build_output(&args).context("failed to open the output")?;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2022 Fluence Labs Limited
|
||||
* Copyright 2023 Fluence Labs Limited
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@ -26,9 +26,8 @@
|
||||
unreachable_patterns
|
||||
)]
|
||||
|
||||
mod run;
|
||||
mod stats;
|
||||
mod utils;
|
||||
mod beautify;
|
||||
mod trace;
|
||||
|
||||
use clap::Parser;
|
||||
|
||||
@ -41,14 +40,19 @@ struct Cli {
|
||||
#[derive(clap::Subcommand)]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
enum Subcommand {
|
||||
Run(crate::run::Args),
|
||||
Stats(crate::stats::Args),
|
||||
#[clap(alias = "b")]
|
||||
Beautify(self::beautify::Args),
|
||||
#[clap(alias = "r")]
|
||||
Run(self::trace::run::Args),
|
||||
#[clap(alias = "s")]
|
||||
Stats(self::trace::stats::Args),
|
||||
}
|
||||
|
||||
fn main() -> anyhow::Result<()> {
|
||||
let args = Cli::parse();
|
||||
match args.subcommand {
|
||||
Subcommand::Run(args) => crate::run::run(args),
|
||||
Subcommand::Stats(args) => crate::stats::stats(args),
|
||||
Subcommand::Run(args) => self::trace::run::run(args),
|
||||
Subcommand::Stats(args) => self::trace::stats::stats(args),
|
||||
Subcommand::Beautify(args) => self::beautify::beautify(args),
|
||||
}
|
||||
}
|
19
tools/cli/air/src/trace/mod.rs
Normal file
19
tools/cli/air/src/trace/mod.rs
Normal file
@ -0,0 +1,19 @@
|
||||
/*
|
||||
* Copyright 2023 Fluence Labs Limited
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
pub(crate) mod run;
|
||||
pub(crate) mod stats;
|
||||
mod utils;
|
@ -14,8 +14,8 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
use super::super::load_data;
|
||||
use super::ExecutionData;
|
||||
use crate::run::load_data;
|
||||
use avm_data_store::AnomalyData;
|
||||
use avm_interface::ParticleParameters;
|
||||
|
@ -14,8 +14,8 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
use super::super::super::utils::unix_timestamp_now;
|
||||
use super::ExecutionData;
|
||||
use crate::utils::unix_timestamp_now;
|
||||
use avm_interface::ParticleParameters;
|
||||
|
||||
use anyhow::Context;
|
||||
@ -44,7 +44,7 @@ pub(crate) struct PlainDataArgs {
|
||||
}
|
||||
|
||||
pub(crate) fn load(args: &PlainDataArgs) -> anyhow::Result<ExecutionData<'_>> {
|
||||
use crate::run::load_data;
|
||||
use super::super::load_data;
|
||||
|
||||
let air_script =
|
||||
read_air_script(args.air_script_path.as_deref()).context("failed to read AIR script")?;
|
@ -14,8 +14,10 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
use super::log_data::{LogKey, LogRecord, Message};
|
||||
use crate::utils::parse_tracing_duration;
|
||||
use super::super::utils::parse_tracing_duration;
|
||||
use super::log_data::LogKey;
|
||||
use super::log_data::LogRecord;
|
||||
use super::log_data::Message;
|
||||
|
||||
use std::{collections::HashMap, time::Duration};
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
Execute an AquaVM special benchmarking suite and recort results with some meta information to `benches/PERFORMANCE.json` database.
|
||||
|
||||
This script is intended to be run from the project root. It uses the `air-trace` through `cargo`, without installation.
|
||||
This script is intended to be run from the project root. It uses the `air` through `cargo`, without installation.
|
||||
|
||||
# Installation
|
||||
|
||||
|
@ -76,7 +76,7 @@ class Bench:
|
||||
"cargo", "run",
|
||||
"--quiet",
|
||||
"--release",
|
||||
"--package", "air-trace",
|
||||
"--package", "aquavm-air-cli",
|
||||
"--",
|
||||
"run",
|
||||
"--json",
|
||||
|
@ -42,7 +42,7 @@ def _prepare(args):
|
||||
])
|
||||
logger.info("Build air-trace...")
|
||||
subprocess.check_call([
|
||||
"cargo", "build", "--release", "--package", "air-trace",
|
||||
"cargo", "build", "--release", "--package", "aquavm-air-cli",
|
||||
])
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user