From e8c7acc400376d6e55054d498bddb23f752a8179 Mon Sep 17 00:00:00 2001 From: Kamil Koczurek Date: Thu, 12 Sep 2024 10:50:51 +0200 Subject: [PATCH] exe-unit: progress merge fixups --- Cargo.lock | 268 +++++++++--- Cargo.toml | 433 ++++++++++---------- exe-unit/Cargo.toml | 106 ++--- exe-unit/components/mock-runtime/Cargo.toml | 30 +- exe-unit/src/exe_unit.rs | 37 +- exe-unit/src/lib.rs | 8 +- 6 files changed, 525 insertions(+), 357 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index dcd9a373c6..cc02d13360 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1163,6 +1163,52 @@ dependencies = [ "pkg-config", ] +[[package]] +name = "camino" +version = "1.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b96ec4966b5813e2c0507c1f86115c8c5abaadc3980879c3424042a02fd1ad3" +dependencies = [ + "serde", +] + +[[package]] +name = "cargo-platform" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24b1f0365a6c6bb4020cd05806fd0d33c44d38046b8bd7f0e40814b9763cabfc" +dependencies = [ + "serde", +] + +[[package]] +name = "cargo_metadata" +version = "0.15.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eee4243f1f26fc7a42710e7439c149e2b10b05472f88090acce52632f231a73a" +dependencies = [ + "camino", + "cargo-platform", + "semver 1.0.23", + "serde", + "serde_json", + "thiserror", +] + +[[package]] +name = "cargo_metadata" +version = "0.18.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2d886547e41f740c616ae73108f6eb70afe6d940c7bc697cb30f13daec073037" +dependencies = [ + "camino", + "cargo-platform", + "semver 1.0.23", + "serde", + "serde_json", + "thiserror", +] + [[package]] name = "cc" version = "1.1.18" @@ -2957,7 +3003,7 @@ dependencies = [ "tokio", "url", "ya-compile-time-utils", - "ya-core-model", + "ya-core-model 0.10.0", "ya-service-bus", ] @@ -3024,7 +3070,7 @@ dependencies = [ "sha3 0.10.8", "thiserror", "url", - "ya-client-model", + "ya-client-model 0.7.0", ] [[package]] @@ -3061,7 +3107,7 @@ dependencies = [ "url", "ya-client", "ya-compile-time-utils", - "ya-core-model", + "ya-core-model 0.10.0", "ya-provider", "ya-utils-path", "ya-utils-process 0.3.0", @@ -3452,6 +3498,16 @@ version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" +[[package]] +name = "humantime-serde" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57a3db5ea5923d99402c94e9feb261dc5ee9b4efa158b0315f788cf549cc200c" +dependencies = [ + "humantime 2.1.0", + "serde", +] + [[package]] name = "hyper" version = "0.14.30" @@ -7476,6 +7532,18 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3369f5ac52d5eb6ab48c6b4ffdc8efbcad6b89c765749064ba298f2c68a16a76" +[[package]] +name = "test-binary" +version = "3.0.2" +source = "git+https://github.com/golemfactory/test-binary.git#c9ebfa3e257455f8365e042b8838a518f2106169" +dependencies = [ + "camino", + "cargo_metadata 0.15.4", + "once_cell", + "paste", + "thiserror", +] + [[package]] name = "test-case" version = "2.2.2" @@ -8765,8 +8833,8 @@ dependencies = [ "tokio", "tokio-stream", "uuid 0.8.2", - "ya-client-model", - "ya-core-model", + "ya-client-model 0.7.0", + "ya-core-model 0.10.0", "ya-gsb-http-proxy", "ya-net", "ya-persistence", @@ -8790,13 +8858,13 @@ dependencies = [ "shlex 1.3.0", "tempdir", "thiserror", - "ya-client-model", + "ya-client-model 0.7.0", ] [[package]] name = "ya-client" version = "0.9.0" -source = "git+https://github.com/golemfactory/ya-client.git?rev=b5369b76044f0a1584532f603c542587e15be852#b5369b76044f0a1584532f603c542587e15be852" +source = "git+https://github.com/golemfactory/ya-client.git?rev=dacad31b5bbd039b8ffc97adb70696655d0872ad#dacad31b5bbd039b8ffc97adb70696655d0872ad" dependencies = [ "actix-codec", "awc", @@ -8814,19 +8882,37 @@ dependencies = [ "structopt", "thiserror", "url", - "ya-client-model", + "ya-client-model 0.7.0", +] + +[[package]] +name = "ya-client-model" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe85a762be0297b9848ad0b7f1c73cb2afe778bb8eb3a952efd032792631a3e0" +dependencies = [ + "bigdecimal 0.2.2", + "chrono", + "derive_more", + "rand 0.8.5", + "serde", + "serde_json", + "strum 0.24.1", + "strum_macros 0.24.3", + "thiserror", ] [[package]] name = "ya-client-model" version = "0.7.0" -source = "git+https://github.com/golemfactory/ya-client.git?rev=b5369b76044f0a1584532f603c542587e15be852#b5369b76044f0a1584532f603c542587e15be852" +source = "git+https://github.com/golemfactory/ya-client.git?rev=dacad31b5bbd039b8ffc97adb70696655d0872ad#dacad31b5bbd039b8ffc97adb70696655d0872ad" dependencies = [ "bigdecimal 0.2.2", "chrono", "derive_more", "diesel", "hex", + "humantime-serde", "openssl", "rand 0.8.5", "secp256k1 0.27.0", @@ -8849,6 +8935,26 @@ dependencies = [ "vergen", ] +[[package]] +name = "ya-core-model" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed4e52e7d5cf8bafaf04daf6abf6bf5b199d291d65d014b7b8ca409ad7b0c599" +dependencies = [ + "chrono", + "derive_more", + "log", + "serde", + "serde_bytes", + "serde_json", + "structopt", + "strum 0.24.1", + "strum_macros 0.24.3", + "thiserror", + "ya-client-model 0.6.0", + "ya-service-bus", +] + [[package]] name = "ya-core-model" version = "0.10.0" @@ -8869,7 +8975,7 @@ dependencies = [ "strum 0.24.1", "strum_macros 0.24.3", "thiserror", - "ya-client-model", + "ya-client-model 0.7.0", "ya-service-bus", ] @@ -8921,8 +9027,8 @@ dependencies = [ "serde_json", "tokio", "uuid 0.8.2", - "ya-client-model", - "ya-core-model", + "ya-client-model 0.7.0", + "ya-core-model 0.10.0", "ya-payment-driver", "ya-persistence", "ya-service-api-interfaces", @@ -8966,8 +9072,8 @@ dependencies = [ "tokio-util", "uuid 0.8.2", "web3", - "ya-client-model", - "ya-core-model", + "ya-client-model 0.7.0", + "ya-core-model 0.10.0", "ya-payment-driver", "ya-service-api-interfaces", "ya-utils-futures", @@ -9007,12 +9113,14 @@ dependencies = [ "serde", "serde_json", "serde_yaml 0.8.26", + "serial_test 0.5.1 (git+https://github.com/tworec/serial_test.git?branch=actix_rt_test)", "sha3 0.8.2", "shell-words", "signal-hook", "socket2 0.4.10", "structopt", "tempdir", + "test-context", "thiserror", "tokio", "tokio-stream", @@ -9020,14 +9128,16 @@ dependencies = [ "trust-dns-resolver 0.22.0", "url", "ya-agreement-utils", - "ya-client-model", + "ya-client-model 0.7.0", "ya-compile-time-utils", - "ya-core-model", + "ya-core-model 0.10.0", "ya-counters", + "ya-framework-basic", "ya-gsb-http-proxy", "ya-manifest-utils", + "ya-mock-runtime", "ya-packet-trace 0.1.0 (git+https://github.com/golemfactory/ya-packet-trace)", - "ya-runtime-api", + "ya-runtime-api 0.7.1", "ya-sb-router", "ya-service-bus", "ya-std-utils", @@ -9072,6 +9182,7 @@ dependencies = [ "async-trait", "awc", "bytes 1.7.1", + "cargo_metadata 0.18.1", "crossterm 0.26.1", "env_logger 0.7.1", "futures 0.3.30", @@ -9089,6 +9200,7 @@ dependencies = [ "sha2 0.8.2", "sha3 0.8.2", "tempdir", + "test-binary", "test-context", "thiserror", "tokio", @@ -9097,8 +9209,8 @@ dependencies = [ "url", "walkdir", "ya-client", - "ya-client-model", - "ya-core-model", + "ya-client-model 0.7.0", + "ya-core-model 0.10.0", "ya-net", "ya-service-bus", "ya-utils-futures", @@ -9143,8 +9255,8 @@ dependencies = [ "uuid 0.8.2", "ya-agreement-utils", "ya-client", - "ya-client-model", - "ya-core-model", + "ya-client-model 0.7.0", + "ya-core-model 0.10.0", "ya-dummy-driver", "ya-erc20-driver", "ya-framework-basic", @@ -9187,8 +9299,8 @@ dependencies = [ "thiserror", "tokio", "uuid 1.10.0", - "ya-client-model", - "ya-core-model", + "ya-client-model 0.7.0", + "ya-core-model 0.10.0", "ya-persistence", "ya-service-api", "ya-service-api-interfaces", @@ -9225,8 +9337,8 @@ dependencies = [ "test-context", "thiserror", "tokio", - "ya-client-model", - "ya-core-model", + "ya-client-model 0.7.0", + "ya-core-model 0.10.0", "ya-counters", "ya-framework-basic", "ya-sb-router", @@ -9267,8 +9379,8 @@ dependencies = [ "thiserror", "tokio", "uuid 0.8.2", - "ya-client-model", - "ya-core-model", + "ya-client-model 0.7.0", + "ya-core-model 0.10.0", "ya-framework-basic", "ya-framework-mocks", "ya-persistence", @@ -9322,7 +9434,7 @@ dependencies = [ "thiserror", "url", "ya-agreement-utils", - "ya-client-model", + "ya-client-model 0.7.0", "ya-manifest-test-utils", "ya-utils-path", ] @@ -9374,7 +9486,7 @@ dependencies = [ "uuid 0.8.2", "ya-agreement-utils", "ya-client", - "ya-core-model", + "ya-core-model 0.10.0", "ya-diesel-utils", "ya-framework-basic", "ya-framework-mocks", @@ -9424,12 +9536,42 @@ dependencies = [ "structopt", "tokio", "url", - "ya-core-model", + "ya-core-model 0.10.0", "ya-service-api", "ya-service-api-interfaces", "ya-service-bus", ] +[[package]] +name = "ya-mock-runtime" +version = "0.1.0" +dependencies = [ + "actix", + "anyhow", + "async-trait", + "bytes 1.7.1", + "env_logger 0.10.2", + "futures 0.3.30", + "hex", + "log", + "portpicker", + "rand 0.8.5", + "serde", + "serde_json", + "thiserror", + "tokio", + "tokio-util", + "url", + "uuid 0.8.2", + "ya-client-model 0.7.0", + "ya-core-model 0.9.1", + "ya-exe-unit", + "ya-framework-basic", + "ya-runtime-api 0.7.0", + "ya-sb-router", + "ya-service-bus", +] + [[package]] name = "ya-net" version = "0.3.0" @@ -9459,8 +9601,8 @@ dependencies = [ "tokio-stream", "tokio-util", "url", - "ya-client-model", - "ya-core-model", + "ya-client-model 0.7.0", + "ya-core-model 0.10.0", "ya-packet-trace 0.1.0 (git+https://github.com/golemfactory/ya-packet-trace)", "ya-relay-client", "ya-sb-proto", @@ -9537,8 +9679,8 @@ dependencies = [ "uuid 0.8.2", "ya-agreement-utils", "ya-client", - "ya-client-model", - "ya-core-model", + "ya-client-model 0.7.0", + "ya-core-model 0.10.0", "ya-dummy-driver", "ya-erc20-driver", "ya-framework-basic", @@ -9583,8 +9725,8 @@ dependencies = [ "sha3 0.9.1", "thiserror", "tokio", - "ya-client-model", - "ya-core-model", + "ya-client-model 0.7.0", + "ya-core-model 0.10.0", "ya-persistence", "ya-service-bus", ] @@ -9607,8 +9749,8 @@ dependencies = [ "test-case 2.2.2", "thiserror", "tokio", - "ya-client-model", - "ya-core-model", + "ya-client-model 0.7.0", + "ya-core-model 0.10.0", "ya-service-api", "ya-service-api-interfaces", "ya-utils-process 0.3.0", @@ -9675,9 +9817,9 @@ dependencies = [ "winapi 0.3.9", "ya-agreement-utils", "ya-client", - "ya-client-model", + "ya-client-model 0.7.0", "ya-compile-time-utils", - "ya-core-model", + "ya-core-model 0.10.0", "ya-file-logging", "ya-framework-basic", "ya-manifest-test-utils", @@ -9746,7 +9888,7 @@ dependencies = [ "tokio-util", "url", "uuid 0.8.2", - "ya-client-model", + "ya-client-model 0.7.0", "ya-relay-proto", "ya-relay-stack 0.5.1", ] @@ -9830,6 +9972,25 @@ dependencies = [ "derive_more", ] +[[package]] +name = "ya-runtime-api" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf0db25811f107d62be6c6ac7444d9c6c3e39714b6f76d72798b66ecce47506f" +dependencies = [ + "anyhow", + "bytes 1.7.1", + "futures 0.3.30", + "log", + "prost 0.10.4", + "prost-build 0.10.4", + "serde", + "serde_json", + "tokio", + "tokio-util", + "url", +] + [[package]] name = "ya-runtime-api" version = "0.7.1" @@ -9917,7 +10078,7 @@ dependencies = [ "lazy_static", "serde", "url", - "ya-core-model", + "ya-core-model 0.10.0", "ya-utils-cli", ] @@ -9968,7 +10129,7 @@ dependencies = [ "structopt", "url", "ya-client", - "ya-core-model", + "ya-core-model 0.10.0", "ya-identity", "ya-persistence", "ya-sb-router", @@ -10011,8 +10172,8 @@ version = "0.2.0" dependencies = [ "anyhow", "graphene-sgx", - "ya-client-model", - "ya-core-model", + "ya-client-model 0.7.0", + "ya-core-model 0.10.0", "ya-service-bus", ] @@ -10096,16 +10257,17 @@ dependencies = [ "test-context", "thiserror", "tokio", + "tokio-stream", "tokio-tar", "tokio-util", "url", "walkdir", "ya-client", - "ya-client-model", - "ya-core-model", + "ya-client-model 0.7.0", + "ya-core-model 0.10.0", "ya-exe-unit", "ya-framework-basic", - "ya-runtime-api", + "ya-runtime-api 0.7.1", "ya-service-bus", "ya-utils-futures", "ya-utils-path", @@ -10229,7 +10391,7 @@ dependencies = [ "tokio", "ya-client", "ya-compile-time-utils", - "ya-core-model", + "ya-core-model 0.10.0", "ya-persistence", "ya-service-api", "ya-service-api-interfaces", @@ -10264,8 +10426,8 @@ dependencies = [ "url", "uuid 0.8.2", "ya-client", - "ya-client-model", - "ya-core-model", + "ya-client-model 0.7.0", + "ya-core-model 0.10.0", "ya-net", "ya-packet-trace 0.1.0 (git+https://github.com/golemfactory/ya-packet-trace)", "ya-persistence", @@ -10307,9 +10469,9 @@ dependencies = [ "url", "ya-activity", "ya-client", - "ya-client-model", + "ya-client-model 0.7.0", "ya-compile-time-utils", - "ya-core-model", + "ya-core-model 0.10.0", "ya-dummy-driver", "ya-erc20-driver", "ya-exe-unit", diff --git a/Cargo.toml b/Cargo.toml index 76fe508d37..62c16458f5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,28 +1,28 @@ [package] -name = "yagna" -version = "0.16.0" -description = "Open platform and marketplace for distributed computations" -readme = "README.md" authors = ["Golem Factory "] +description = "Open platform and marketplace for distributed computations" +edition = "2018" homepage = "https://github.com/golemfactory/yagna/core/serv" -repository = "https://github.com/golemfactory/yagna" license = "GPL-3.0" -edition = "2018" +name = "yagna" +readme = "README.md" +repository = "https://github.com/golemfactory/yagna" +version = "0.16.0" [features] default = ['erc20-driver', 'gftp/bin'] -static-openssl = ["openssl/vendored", "openssl-probe"] dummy-driver = ['ya-dummy-driver'] erc20-driver = ['ya-erc20-driver'] +framework-test = ['ya-exe-unit/system-test', 'ya-payment/framework-test', 'ya-identity/framework-test'] +static-openssl = ["openssl/vendored", "openssl-probe"] tos = [] -framework-test = ['ya-exe-unit/framework-test', 'ya-payment/framework-test', 'ya-identity/framework-test'] # Temporary to make goth integration tests work central-net = ['ya-net/central-net'] packet-trace-enable = [ - "ya-vpn/packet-trace-enable", - "ya-file-logging/packet-trace-enable", - "ya-net/packet-trace-enable", - "ya-service-bus/packet-trace-enable", + "ya-vpn/packet-trace-enable", + "ya-file-logging/packet-trace-enable", + "ya-net/packet-trace-enable", + "ya-service-bus/packet-trace-enable", ] [[bin]] @@ -30,40 +30,40 @@ name = "yagna" path = "core/serv/src/main.rs" [dependencies] +gftp = {workspace = true, optional = true} ya-activity = "0.4" +ya-client-model.workspace = true +ya-client.workspace = true ya-compile-time-utils = "0.2" ya-core-model.workspace = true -ya-dummy-driver = { version = "0.3", optional = true } +ya-dummy-driver = {version = "0.3", optional = true} +ya-erc20-driver = {version = "0.4", optional = true} +ya-fd-metrics = {path = "utils/fd-metrics"} ya-file-logging = "0.1" ya-gsb-api = "0.1" -ya-erc20-driver = { version = "0.4", optional = true } ya-identity = "0.3" ya-market = "0.4" ya-metrics = "0.2" -ya-net = { version = "0.3", features = ["service"] } +ya-net = {version = "0.3", features = ["service"]} ya-payment = "0.3" -ya-persistence = { version = "0.3", features = ["service"] } -ya-sb-proto = { workspace = true } -ya-sb-router = { workspace = true } +ya-persistence = {version = "0.3", features = ["service"]} +ya-sb-proto = {workspace = true} +ya-sb-router = {workspace = true} ya-service-api = "0.1" ya-service-api-derive = "0.2" ya-service-api-interfaces = "0.2" ya-service-api-web = "0.2" -ya-service-bus = { workspace = true } +ya-service-bus = {workspace = true} ya-sgx = "0.2" -ya-utils-path = "0.1" ya-utils-futures.workspace = true -ya-utils-process = { version = "0.2", features = ["lock"] } ya-utils-networking = "0.2" -ya-fd-metrics = { path = "utils/fd-metrics" } +ya-utils-path = "0.1" +ya-utils-process = {version = "0.2", features = ["lock"]} ya-version = "0.2" ya-vpn = "0.2" -ya-client.workspace = true -ya-client-model.workspace = true -gftp = { workspace = true, optional = true } # just to enable gftp build for cargo-deb -ya-provider = { version = "0.3", optional = true } # just to enable conditionally running some tests -ya-exe-unit = { version = "0.4", optional = true, path = "exe-unit" } # just to enable conditionally running some tests +ya-exe-unit = {version = "0.4", optional = true, path = "exe-unit"}# just to enable conditionally running some tests +ya-provider = {version = "0.3", optional = true}# just to enable conditionally running some tests actix-rt = "2.7" actix-service = "2" @@ -74,163 +74,161 @@ directories = "2.0.2" dotenv = "0.15.0" futures = "0.3" lazy_static = "1.4" +libsqlite3-sys = {workspace = true} log = "0.4" metrics = "0.12" num_cpus = "1" +openssl-probe = {version = "0.1", optional = true} openssl.workspace = true -openssl-probe = { version = "0.1", optional = true } serde = "1.0" serde_json = "1.0" structopt = "0.3" -tokio = { version = "1", features = ["net"] } -tokio-util = { version = "0.7", features = ["codec"] } -tokio-stream = { version = "0.1.8", features = ["io-util"] } +tokio = {version = "1", features = ["net"]} +tokio-stream = {version = "0.1.8", features = ["io-util"]} +tokio-util = {version = "0.7", features = ["codec"]} url = "2.1.1" -libsqlite3-sys = { workspace = true } - [dev-dependencies] -erc20_processor = { workspace = true } +erc20_processor = {workspace = true} +ya-exe-unit = {version = "0.4", path = "exe-unit"} ya-test-framework = "0.1" -ya-exe-unit = { version = "0.4", path = "exe-unit" } [package.metadata.deb] -name = "golem-requestor" assets = [ - [ - "target/release/yagna", - "usr/bin/", - "755", - ], - [ - "target/release/gftp", - "usr/bin/", - "755", - ], - [ - "README.md", - "usr/share/doc/yagna/", - "644", - ], - [ - "core/serv/README.md", - "usr/share/doc/yagna/service.md", - "644", - ], + [ + "target/release/yagna", + "usr/bin/", + "755", + ], + [ + "target/release/gftp", + "usr/bin/", + "755", + ], + [ + "README.md", + "usr/share/doc/yagna/", + "644", + ], + [ + "core/serv/README.md", + "usr/share/doc/yagna/service.md", + "644", + ], ] conflicts = "ya-provider" -features = ["static-openssl"] -maintainer-scripts = "debian/core" depends = "libgcc1, libc6 (>= 2.23)" extended-description = """The Next Golem Milestone. An open platform and marketplace for distributed computations. """ - +features = ["static-openssl"] +maintainer-scripts = "debian/core" +name = "golem-requestor" [package.metadata.deb.variants.provider] -name = "golem-provider" -replaces = "golem-requestor" -maintainer-scripts = "debian/provider" -features = ["static-openssl"] -depends = "libgcc1, libc6 (>= 2.23)" assets = [ - [ - "target/release/yagna", - "usr/bin/", - "755", - ], - [ - "target/release/ya-provider", - "usr/bin/", - "755", - ], - [ - "target/release/gftp", - "usr/bin/", - "755", - ], - [ - "target/release/exe-unit", - "usr/lib/yagna/plugins/", - "755", - ], - [ - "target/release/golemsp", - "usr/bin/", - "755", - ], - [ - "README.md", - "usr/share/doc/yagna/", - "644", - ], - [ - "core/serv/README.md", - "usr/share/doc/yagna/service.md", - "644", - ], - [ - "agent/provider/readme.md", - "usr/share/doc/yagna/run-provider.md", - "644", - ], + [ + "target/release/yagna", + "usr/bin/", + "755", + ], + [ + "target/release/ya-provider", + "usr/bin/", + "755", + ], + [ + "target/release/gftp", + "usr/bin/", + "755", + ], + [ + "target/release/exe-unit", + "usr/lib/yagna/plugins/", + "755", + ], + [ + "target/release/golemsp", + "usr/bin/", + "755", + ], + [ + "README.md", + "usr/share/doc/yagna/", + "644", + ], + [ + "core/serv/README.md", + "usr/share/doc/yagna/service.md", + "644", + ], + [ + "agent/provider/readme.md", + "usr/share/doc/yagna/run-provider.md", + "644", + ], ] +depends = "libgcc1, libc6 (>= 2.23)" +features = ["static-openssl"] +maintainer-scripts = "debian/provider" +name = "golem-provider" +replaces = "golem-requestor" [workspace.lints.clippy] arc_with_non_send_sync = "allow" -get_first = "allow" blocks_in_conditions = "allow" +get_first = "allow" [workspace] members = [ - "agent/provider", - "core/activity", - "core/gftp", - "core/gsb-api", - "core/identity", - "core/market", - "core/market/resolver", - "core/model", - "core/net", - "core/payment", - "core/payment-driver/base", - "core/payment-driver/dummy", - "core/payment-driver/erc20", - "core/persistence", - "core/serv-api", - "core/serv-api/derive", - "core/serv-api/interfaces", - "core/serv-api/web", - "core/sgx", - "core/version", - "core/vpn", - "exe-unit/components/counters", - "exe-unit/components/gsb-http-proxy", - "exe-unit", - "exe-unit/runtime-api", - "exe-unit/tokio-process-ns", - "exe-unit/components/transfer", - "golem_cli", - "utils/actix_utils", - "utils/agreement-utils", - "utils/cli", - "utils/compile-time-utils", - "utils/file-logging", - "utils/futures", - "utils/manifest-utils", - "utils/manifest-utils/test-utils", - "utils/networking", - "utils/path", - "utils/process", - "utils/std-utils", - "utils/diesel-utils", - "utils/fd-metrics", - "core/metrics", - "test-utils/test-framework", - "test-utils/test-framework/framework-macro", - "test-utils/test-framework/framework-basic", - "test-utils/test-framework/framework-mocks", + "agent/provider", + "core/activity", + "core/gftp", + "core/gsb-api", + "core/identity", + "core/market", + "core/market/resolver", + "core/model", + "core/net", + "core/payment", + "core/payment-driver/base", + "core/payment-driver/dummy", + "core/payment-driver/erc20", + "core/persistence", + "core/serv-api", + "core/serv-api/derive", + "core/serv-api/interfaces", + "core/serv-api/web", + "core/sgx", + "core/version", + "core/vpn", + "exe-unit/components/counters", + "exe-unit/components/gsb-http-proxy", + "exe-unit", + "exe-unit/runtime-api", + "exe-unit/tokio-process-ns", + "exe-unit/components/transfer", + "golem_cli", + "utils/actix_utils", + "utils/agreement-utils", + "utils/cli", + "utils/compile-time-utils", + "utils/file-logging", + "utils/futures", + "utils/manifest-utils", + "utils/manifest-utils/test-utils", + "utils/networking", + "utils/path", + "utils/process", + "utils/std-utils", + "utils/diesel-utils", + "utils/fd-metrics", + "core/metrics", + "test-utils/test-framework", + "test-utils/test-framework/framework-macro", + "test-utils/test-framework/framework-basic", + "test-utils/test-framework/framework-mocks", ] [workspace.dependencies] @@ -238,34 +236,34 @@ members = [ # diesel 1.4.* supports up to 0.23.0, but sqlx 0.5.9 requires 0.22.0 # sqlx 0.5.10 need 0.23.2, so 0.5.9 is last version possible derive_more = "0.99.11" -erc20_payment_lib = { git = "https://github.com/golemfactory/erc20_payment_lib", rev = "4200567b931af64f4fb1f6b756dd6d051576b64f" } -erc20_processor = { git = "https://github.com/golemfactory/erc20_payment_lib", rev = "4200567b931af64f4fb1f6b756dd6d051576b64f" } +erc20_payment_lib = {git = "https://github.com/golemfactory/erc20_payment_lib", rev = "4200567b931af64f4fb1f6b756dd6d051576b64f"} +erc20_processor = {git = "https://github.com/golemfactory/erc20_payment_lib", rev = "4200567b931af64f4fb1f6b756dd6d051576b64f"} #erc20_payment_lib = { path = "../../payments/erc20_payment_lib/crates/erc20_payment_lib" } #erc20_processor = { path = "../../payments/erc20_payment_lib" } #erc20_payment_lib = { version = "0.4.7" } #erc20_processor = { version = "0.4.7" } -gftp = { version = "0.4.1", path = "core/gftp" } +gftp = {version = "0.4.1", path = "core/gftp"} hex = "0.4.3" -libsqlite3-sys = { version = "0.26.0", features = ["bundled"] } +libsqlite3-sys = {version = "0.26.0", features = ["bundled"]} openssl = "0.10" rand = "0.8.5" -strum = { version = "0.24", features = ["derive"] } +regex = "1.10.4" +strum = {version = "0.24", features = ["derive"]} trust-dns-resolver = "0.22" url = "2.3.1" -regex = "1.10.4" -ya-agreement-utils = { version = "0.6", path = "utils/agreement-utils" } -ya-core-model = { version = "0.10", path = "core/model" } -ya-relay-client = { git = "https://github.com/golemfactory/ya-relay.git", rev = "e199ee1cfdb22837f9d95f4202378e182d3cb489" } -ya-relay-stack = { git = "https://github.com/golemfactory/ya-relay.git", rev = "c92a75b0cf062fcc9dbb3ea2a034d913e5fad8e5" } -ya-utils-futures = { path = "utils/futures" } +ya-agreement-utils = {version = "0.6", path = "utils/agreement-utils"} +ya-core-model = {version = "0.10", path = "core/model"} +ya-relay-client = {git = "https://github.com/golemfactory/ya-relay.git", rev = "e199ee1cfdb22837f9d95f4202378e182d3cb489"} +ya-relay-stack = {git = "https://github.com/golemfactory/ya-relay.git", rev = "c92a75b0cf062fcc9dbb3ea2a034d913e5fad8e5"} +ya-utils-futures = {path = "utils/futures"} -ya-service-bus = { version = "0.7.3", features = ['tls'] } -ya-sb-router = { version = "0.6.4" } -ya-sb-proto = { version = "0.6.2" } -ya-sb-util = { version = "0.5.1" } -parking_lot = "0.12.3" mime = "0.3.17" +parking_lot = "0.12.3" +ya-sb-proto = {version = "0.6.2"} +ya-sb-router = {version = "0.6.4"} +ya-sb-util = {version = "0.5.1"} +ya-service-bus = {version = "0.7.3", features = ['tls']} # true version is given in patches section ya-client = "0.9" # true version is given in patches section @@ -273,34 +271,34 @@ ya-client-model = "0.7" [patch.crates-io] ## SERVICES -ya-identity = { path = "core/identity" } -ya-net = { path = "core/net" } -ya-market = { path = "core/market" } -ya-market-resolver = { path = "core/market/resolver" } -ya-activity = { path = "core/activity" } -ya-sgx = { path = "core/sgx" } -ya-payment = { path = "core/payment" } -ya-payment-driver = { path = "core/payment-driver/base" } -ya-dummy-driver = { path = "core/payment-driver/dummy" } -ya-erc20-driver = { path = "core/payment-driver/erc20" } -ya-version = { path = "core/version" } -ya-vpn = { path = "core/vpn" } -ya-gsb-api = { path = "core/gsb-api" } +ya-activity = {path = "core/activity"} +ya-dummy-driver = {path = "core/payment-driver/dummy"} +ya-erc20-driver = {path = "core/payment-driver/erc20"} +ya-gsb-api = {path = "core/gsb-api"} +ya-identity = {path = "core/identity"} +ya-market = {path = "core/market"} +ya-market-resolver = {path = "core/market/resolver"} +ya-net = {path = "core/net"} +ya-payment = {path = "core/payment"} +ya-payment-driver = {path = "core/payment-driver/base"} +ya-sgx = {path = "core/sgx"} +ya-version = {path = "core/version"} +ya-vpn = {path = "core/vpn"} ## CORE UTILS -ya-core-model = { path = "core/model" } -ya-persistence = { path = "core/persistence" } -ya-service-api = { path = "core/serv-api" } -ya-service-api-derive = { path = "core/serv-api/derive" } -ya-service-api-interfaces = { path = "core/serv-api/interfaces" } -ya-service-api-web = { path = "core/serv-api/web" } +ya-core-model = {path = "core/model"} +ya-persistence = {path = "core/persistence"} +ya-service-api = {path = "core/serv-api"} +ya-service-api-derive = {path = "core/serv-api/derive"} +ya-service-api-interfaces = {path = "core/serv-api/interfaces"} +ya-service-api-web = {path = "core/serv-api/web"} ## CLIENT -ya-client = { git = "https://github.com/golemfactory/ya-client.git", rev = "dacad31b5bbd039b8ffc97adb70696655d0872ad" } +ya-client = {git = "https://github.com/golemfactory/ya-client.git", rev = "dacad31b5bbd039b8ffc97adb70696655d0872ad"} #ya-client = { path = "../ya-client" } -ya-client-model = { git = "https://github.com/golemfactory/ya-client.git", rev = "dacad31b5bbd039b8ffc97adb70696655d0872ad" } +ya-client-model = {git = "https://github.com/golemfactory/ya-client.git", rev = "dacad31b5bbd039b8ffc97adb70696655d0872ad"} #ya-client-model = { path = "../ya-client/model" } -golem-certificate = { git = "https://github.com/golemfactory/golem-certificate.git", rev = "952fdbd47adc57e46b7370935111e046271ef415" } +golem-certificate = {git = "https://github.com/golemfactory/golem-certificate.git", rev = "952fdbd47adc57e46b7370935111e046271ef415"} ## RELAY and networking stack @@ -309,39 +307,38 @@ golem-certificate = { git = "https://github.com/golemfactory/golem-certificate.g #ya-relay-core = { path = "../ya-relay/crates/core" } #ya-relay-proto = { path = "../ya-relay/crates/proto" } - ## OTHERS -gftp = { path = "core/gftp" } -tokio-process-ns = { path = "exe-unit/tokio-process-ns" } -ya-agreement-utils = { path = "utils/agreement-utils" } -ya-std-utils = { path = "utils/std-utils" } -ya-compile-time-utils = { path = "utils/compile-time-utils" } -ya-exe-unit = { path = "exe-unit" } -ya-file-logging = { path = "utils/file-logging" } -ya-manifest-utils = { path = "utils/manifest-utils" } -ya-transfer = { path = "exe-unit/components/transfer" } -ya-utils-actix = { path = "utils/actix_utils" } -ya-utils-cli = { path = "utils/cli" } -ya-utils-networking = { path = "utils/networking" } -ya-utils-path = { path = "utils/path" } -ya-utils-process = { path = "utils/process" } -ya-diesel-utils = { path = "utils/diesel-utils" } -ya-metrics = { path = "core/metrics" } -ya-provider = { path = "agent/provider" } -ya-counters = { path = "exe-unit/components/counters" } -ya-gsb-http-proxy = { path = "exe-unit/components/gsb-http-proxy" } +gftp = {path = "core/gftp"} +tokio-process-ns = {path = "exe-unit/tokio-process-ns"} +ya-agreement-utils = {path = "utils/agreement-utils"} +ya-compile-time-utils = {path = "utils/compile-time-utils"} +ya-counters = {path = "exe-unit/components/counters"} +ya-diesel-utils = {path = "utils/diesel-utils"} +ya-exe-unit = {path = "exe-unit"} +ya-file-logging = {path = "utils/file-logging"} +ya-gsb-http-proxy = {path = "exe-unit/components/gsb-http-proxy"} +ya-manifest-utils = {path = "utils/manifest-utils"} +ya-metrics = {path = "core/metrics"} +ya-provider = {path = "agent/provider"} +ya-std-utils = {path = "utils/std-utils"} +ya-transfer = {path = "exe-unit/components/transfer"} +ya-utils-actix = {path = "utils/actix_utils"} +ya-utils-cli = {path = "utils/cli"} +ya-utils-networking = {path = "utils/networking"} +ya-utils-path = {path = "utils/path"} +ya-utils-process = {path = "utils/process"} ## TEST UTILS -ya-manifest-test-utils = { path = "utils/manifest-utils/test-utils" } -ya-test-framework = { path = "test-utils/test-framework" } -ya-framework-macro = { path = "test-utils/test-framework/framework-macro" } -ya-framework-basic = { path = "test-utils/test-framework/framework-basic" } -ya-framework-mocks = { path = "test-utils/test-framework/framework-mocks" } +ya-framework-basic = {path = "test-utils/test-framework/framework-basic"} +ya-framework-macro = {path = "test-utils/test-framework/framework-macro"} +ya-framework-mocks = {path = "test-utils/test-framework/framework-mocks"} +ya-manifest-test-utils = {path = "utils/manifest-utils/test-utils"} +ya-test-framework = {path = "test-utils/test-framework"} -ethereum-tx-sign = { git = "https://github.com/golemfactory/ethereum-tx-sign.git", rev = "1164c74187a9e2947faeaea7dde104c3cdec4195" } -graphene-sgx = { git = " https://github.com/golemfactory/graphene-rust.git", rev = "dbd993ebad7f9190410ea390a589348479af6407" } +ethereum-tx-sign = {git = "https://github.com/golemfactory/ethereum-tx-sign.git", rev = "1164c74187a9e2947faeaea7dde104c3cdec4195"} +graphene-sgx = {git = " https://github.com/golemfactory/graphene-rust.git", rev = "dbd993ebad7f9190410ea390a589348479af6407"} -diesel = { git = "https://github.com/golemfactory/yagna-diesel-patch.git", rev = "a512c66d520a9066dd9a4d1416f9109019b39563" } +diesel = {git = "https://github.com/golemfactory/yagna-diesel-patch.git", rev = "a512c66d520a9066dd9a4d1416f9109019b39563"} # Speed up builds on macOS (will be default in next rust version probably) # https://jakedeichert.com/blog/reducing-rust-incremental-compilation-times-on-macos-by-70-percent/ diff --git a/exe-unit/Cargo.toml b/exe-unit/Cargo.toml index 53d30476d2..ff1eb42248 100644 --- a/exe-unit/Cargo.toml +++ b/exe-unit/Cargo.toml @@ -1,8 +1,8 @@ [package] -name = "ya-exe-unit" -version = "0.4.0" authors = ["Golem Factory "] edition = "2018" +name = "ya-exe-unit" +version = "0.4.0" [lib] name = "ya_exe_unit" @@ -13,64 +13,64 @@ name = "exe-unit" path = "src/bin.rs" [features] -default = ['compat-deployment'] compat-deployment = [] +default = ['compat-deployment'] +packet-trace-enable = ["ya-packet-trace/enable"] sgx = [ - 'graphene-sgx', - 'openssl/vendored', - 'secp256k1/rand', - 'ya-client-model/sgx', - 'ya-core-model/sgx', - 'ya-transfer/sgx', + 'graphene-sgx', + 'openssl/vendored', + 'secp256k1/rand', + 'ya-client-model/sgx', + 'ya-core-model/sgx', + 'ya-transfer/sgx', ] -packet-trace-enable = ["ya-packet-trace/enable"] system-test = ["ya-transfer/system-test"] [dependencies] -ya-agreement-utils = { workspace = true } -ya-manifest-utils = { version = "0.2" } +ya-agreement-utils = {workspace = true} ya-client-model.workspace = true ya-compile-time-utils = "0.2" -ya-core-model = { workspace = true, features = ["activity", "appkey"] } -ya-runtime-api = { version = "0.7", path = "runtime-api", features = [ - "server", -] } -ya-service-bus = { workspace = true } +ya-core-model = {workspace = true, features = ["activity", "appkey"]} +ya-counters = {path = "../exe-unit/components/counters", features = ["os"]} +ya-gsb-http-proxy = {path = "../exe-unit/components/gsb-http-proxy"} +ya-manifest-utils = {version = "0.2"} +ya-packet-trace = {git = "https://github.com/golemfactory/ya-packet-trace"} +ya-runtime-api = {version = "0.7", path = "runtime-api", features = [ + "server", +]} +ya-service-bus = {workspace = true} +ya-std-utils = "0.1" ya-transfer = "0.3" -ya-utils-path = "0.1" ya-utils-futures.workspace = true -ya-std-utils = "0.1" -ya-utils-networking = { version = "0.2", default-features = false, features = [ - "dns", - "vpn", -] } +ya-utils-networking = {version = "0.2", default-features = false, features = [ + "dns", + "vpn", +]} +ya-utils-path = "0.1" ya-utils-process = "0.3" -ya-packet-trace = { git = "https://github.com/golemfactory/ya-packet-trace" } -ya-gsb-http-proxy = { path = "../exe-unit/components/gsb-http-proxy" } -ya-counters = { path = "../exe-unit/components/counters", features = ["os"] } -actix = { version = "0.13", default-features = false } +actix = {version = "0.13", default-features = false} actix-rt = "2.7" anyhow = "1.0" async-trait = "0.1.24" bytes = "1" chrono = "0.4" derivative = "2.1" -derive_more = { workspace = true } +derive_more = {workspace = true} dotenv = "0.15.0" -flexi_logger = { version = "0.22", features = ["colors"] } +flexi_logger = {version = "0.22", features = ["colors"]} futures = "0.3" -graphene-sgx = { version = "0.3.3", optional = true } +graphene-sgx = {version = "0.3.3", optional = true} hex = "0.4.2" ipnet = "2.3" lazy_static = "1.4.0" log = "0.4" -openssl = { workspace = true, optional = true } +openssl = {workspace = true, optional = true} rand = "0.8.5" regex = "1.5" -reqwest = { version = "0.11", optional = false, features = ["stream"] } -secp256k1 = { version = "0.27.0", optional = true } -serde = { version = "^1.0", features = ["derive"] } +reqwest = {version = "0.11", optional = false, features = ["stream"]} +secp256k1 = {version = "0.27.0", optional = true} +serde = {version = "^1.0", features = ["derive"]} serde_json = "1.0" serde_yaml = "0.8" sha3 = "0.8.2" @@ -79,39 +79,39 @@ socket2 = "0.4" structopt = "0.3" thiserror = "1.0" # keep the "rt-multi-thread" feature -tokio = { version = "1", features = [ - "process", - "signal", - "time", - "net", - "rt-multi-thread", -] } -tokio-util = { version = "0.7.2", features = ["codec", "net"] } -tokio-stream = { version = "0.1.8", features = ["io-util", "sync"] } +async-stream = "0.3.5" +tokio = {version = "1", features = [ + "process", + "signal", + "time", + "net", + "rt-multi-thread", +]} +tokio-stream = {version = "0.1.8", features = ["io-util", "sync"]} +tokio-util = {version = "0.7.2", features = ["codec", "net"]} +trust-dns-resolver = {workspace = true} url = "2.1" yansi = "0.5.0" -trust-dns-resolver = { workspace = true } -async-stream = "0.3.5" [dev-dependencies] -ya-runtime-api = { version = "0.7", path = "runtime-api", features = [ - "codec", - "server", -] } -ya-sb-router = { workspace = true } +ya-runtime-api = {version = "0.7", path = "runtime-api", features = [ + "codec", + "server", +]} +ya-sb-router = {workspace = true} actix-files = "0.6" actix-web = "4" env_logger = "0.7" rustyline = "7.0.0" -serial_test = { git = "https://github.com/tworec/serial_test.git", branch = "actix_rt_test", features = ["actix-rt2"]} +serial_test = {git = "https://github.com/tworec/serial_test.git", branch = "actix_rt_test", features = ["actix-rt2"]} sha3 = "0.8.2" shell-words = "1.0.0" tempdir = "0.3.7" test-context = "0.1.4" -ya-framework-basic = { version = "0.1" } -ya-mock-runtime = { path = "components/mock-runtime"} +ya-framework-basic = {version = "0.1"} +ya-mock-runtime = {path = "components/mock-runtime"} [lints] workspace = true diff --git a/exe-unit/components/mock-runtime/Cargo.toml b/exe-unit/components/mock-runtime/Cargo.toml index 5055bb4a03..13921a1367 100644 --- a/exe-unit/components/mock-runtime/Cargo.toml +++ b/exe-unit/components/mock-runtime/Cargo.toml @@ -1,10 +1,9 @@ [package] -name = "ya-mock-runtime" -version = "0.1.0" authors = ["Golem Factory "] -edition = "2021" description = "Mock runtime for testing purposes and set of libraries for testing ExeUnits in tests." - +edition = "2021" +name = "ya-mock-runtime" +version = "0.1.0" [lib] path = "src/lib.rs" @@ -13,33 +12,32 @@ path = "src/lib.rs" name = "ya-mock-runtime" path = "src/main.rs" - [dependencies] anyhow = "1.0.31" bytes = "1.0" -futures = { version = "0.3" } -log = "0.4" env_logger = "0.10" -serde = { version = "1.0", features = ["derive"] } +futures = {version = "0.3"} +log = "0.4" +serde = {version = "1.0", features = ["derive"]} serde_json = "1.0" thiserror = "1.0" -tokio = { version = "1", features = ["io-std", "rt", "process", "sync", "macros", "time"] } -tokio-util = { version = "0.7", features = ["codec"] } +tokio = {version = "1", features = ["io-std", "rt", "process", "sync", "macros", "time"]} +tokio-util = {version = "0.7", features = ["codec"]} url = "2.3" ya-runtime-api = "0.7" # Dependancies for ExeUnit testing utils +ya-client-model.workspace = true +ya-core-model = {version = "^0.9", features = ["activity", "appkey"]} ya-exe-unit = "0.4" -ya-framework-basic = { version = "0.1" } -ya-client-model = "0.6" -ya-core-model = { version = "^0.9", features = ["activity", "appkey"] } -ya-service-bus = { workspace = true } +ya-framework-basic = {version = "0.1"} ya-sb-router = "0.6" +ya-service-bus = {workspace = true} +actix = {version = "0.13", default-features = false} async-trait = "0.1.77" -actix = { version = "0.13", default-features = false } hex = "0.4.3" portpicker = "0.1.1" rand = "0.8.5" -uuid = { version = "0.8.2", features = ["v4"] } +uuid = {version = "0.8.2", features = ["v4"]} diff --git a/exe-unit/src/exe_unit.rs b/exe-unit/src/exe_unit.rs index 086d33fc43..5b8936ace3 100644 --- a/exe-unit/src/exe_unit.rs +++ b/exe-unit/src/exe_unit.rs @@ -9,6 +9,9 @@ use futures::{FutureExt, SinkExt}; use std::path::PathBuf; use std::time::Duration; use tokio::sync::broadcast; +use ya_counters::error::CounterError; +use ya_counters::message::GetCounters; +use ya_counters::service::CountersService; use ya_agreement_utils::OfferTemplate; use ya_client_model::activity::{ActivityUsage, CommandOutput, ExeScriptCommand, State, StatePair}; @@ -26,12 +29,11 @@ use crate::acl::Acl; use crate::agreement::Agreement; use crate::error::Error; use crate::message::{ - ExecuteCommand, GetMetrics, GetStdOut, Initialize, RuntimeEvent, SetState, Shutdown, - ShutdownReason, SignExeScript, Stop, UpdateDeployment, + ExecuteCommand, GetStdOut, Initialize, RuntimeEvent, SetState, Shutdown, ShutdownReason, + SignExeScript, Stop, UpdateDeployment, }; use crate::runtime::{Runtime, RuntimeMode}; -use crate::service::metrics::MetricsService; -use crate::service::{ServiceAddr, ServiceControl}; +use crate::service::{self, ServiceAddr, ServiceControl}; use crate::state::{ExeUnitState, StateError, Supervision}; use crate::Result; @@ -48,7 +50,7 @@ pub struct ExeUnit { pub(crate) state: ExeUnitState, pub(crate) events: Channel, pub(crate) runtime: Addr, - pub(crate) metrics: Addr, + pub(crate) counters: Addr, pub(crate) transfers: Addr, pub(crate) services: Vec>, pub(crate) shutdown_tx: broadcast::Sender<()>, @@ -57,7 +59,7 @@ pub struct ExeUnit { impl ExeUnit { pub fn new( ctx: ExeUnitContext, - metrics: Addr, + counters: Addr, transfers: Addr, runtime: Addr, ) -> Self { @@ -67,10 +69,10 @@ impl ExeUnit { state: ExeUnitState::default(), events: Channel::default(), runtime: runtime.clone(), - metrics: metrics.clone(), + counters: counters.clone(), transfers: transfers.clone(), services: vec![ - Box::new(ServiceAddr::new(metrics)), + Box::new(ServiceAddr::new(counters)), Box::new(ServiceAddr::new(transfers)), Box::new(ServiceAddr::new(runtime)), ], @@ -83,7 +85,7 @@ impl ExeUnit { let runtime_template = RuntimeProcess::offer_template(binary, args)?; let supervisor_template = OfferTemplate::new(serde_json::json!({ - "golem.com.usage.vector": MetricsService::usage_vector(), + "golem.com.usage.vector": service::counters::usage_vector(), "golem.activity.caps.transfer.protocol": TransferService::schemes(), "golem.activity.caps.transfer.report-progress": true, "golem.activity.caps.deploy.report-progress": true, @@ -105,7 +107,7 @@ impl ExeUnit { self.ctx.report_url.clone().unwrap(), self.ctx.activity_id.clone().unwrap(), context.address(), - self.metrics.clone(), + self.counters.clone(), ); context.spawn(fut.into_actor(self)); } @@ -555,9 +557,9 @@ async fn report_usage( report_url: String, activity_id: String, exe_unit: Addr>, - metrics: Addr, + metrics: Addr, ) { - match metrics.send(GetMetrics).await { + match metrics.send(GetCounters).await { Ok(resp) => match resp { Ok(data) => { let msg = activity::local::SetUsage { @@ -575,7 +577,7 @@ async fn report_usage( } } Err(err) => match err { - Error::UsageLimitExceeded(info) => { + CounterError::UsageLimitExceeded(info) => { log::warn!("Usage limit exceeded: {}", info); exe_unit.do_send(Shutdown(ShutdownReason::UsageLimitExceeded(info))); } @@ -602,3 +604,12 @@ impl Handler for TransferService { async move { Ok(addr.send(ya_transfer::transfer::Shutdown {}).await??) }.boxed_local() } } + +impl Handler for CountersService { + type Result = ResponseFuture>; + + fn handle(&mut self, _msg: Shutdown, ctx: &mut Self::Context) -> Self::Result { + let addr = ctx.address(); + async move { Ok(addr.send(ya_counters::message::Shutdown {}).await??) }.boxed_local() + } +} diff --git a/exe-unit/src/lib.rs b/exe-unit/src/lib.rs index 7d9ac9e7db..d76bac574a 100644 --- a/exe-unit/src/lib.rs +++ b/exe-unit/src/lib.rs @@ -6,6 +6,7 @@ use anyhow::{bail, Context}; use std::convert::TryFrom; use std::path::PathBuf; use structopt::clap; +use ya_counters::service::CountersServiceBuilder; use ya_client_model::activity::ExeScriptCommand; use ya_core_model::activity; @@ -18,7 +19,6 @@ use crate::error::Error; use crate::manifest::ManifestContext; use crate::message::{GetState, GetStateResponse, Register}; use crate::runtime::process::RuntimeProcess; -use crate::service::metrics::MetricsService; use crate::service::signal::SignalMonitor; use crate::state::Supervision; @@ -31,11 +31,9 @@ mod handlers; pub mod logger; pub mod manifest; pub mod message; -pub mod metrics; mod network; mod notify; mod output; -pub mod process; pub mod runtime; pub mod service; pub mod state; @@ -371,7 +369,9 @@ pub async fn exe_unit(mut config: ExeUnitConfig) -> anyhow::Result