From 390b110fcc62b4ef30e85ae7bb9a819b7b8ee002 Mon Sep 17 00:00:00 2001 From: Robert Debug Date: Tue, 19 Jan 2021 10:56:37 +0100 Subject: [PATCH] sum2 --- rust/Cargo.lock | 396 +++++++++++++++++++++++ rust/e2e/Cargo.toml | 10 +- rust/e2e/src/bin/test_case_1/config.toml | 4 +- rust/e2e/src/test_client/builder.rs | 8 +- rust/e2e/src/test_client/runner.rs | 9 +- 5 files changed, 418 insertions(+), 9 deletions(-) diff --git a/rust/Cargo.lock b/rust/Cargo.lock index a517b5e11..670095f20 100644 --- a/rust/Cargo.lock +++ b/rust/Cargo.lock @@ -1,5 +1,21 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. +[[package]] +name = "Inflector" +version = "0.11.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe438c63458706e03479442743baae6c88256498e6431708f6dfc520a26515d3" +dependencies = [ + "lazy_static", + "regex", +] + +[[package]] +name = "adler" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee2a4ec343196209d6594e19543ae87a39f96d5534d7174822a3ad825dd6ed7e" + [[package]] name = "aead" version = "0.3.2" @@ -54,6 +70,15 @@ dependencies = [ "opaque-debug 0.3.0", ] +[[package]] +name = "ahash" +version = "0.3.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e8fd72866655d1904d6b0997d0b07ba561047d070fbe29de039031c641b61217" +dependencies = [ + "const-random", +] + [[package]] name = "aho-corasick" version = "0.7.15" @@ -93,6 +118,12 @@ version = "0.4.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dabe5a181f83789739c194cbe5a897dde195078fac08568d09221fd6137a7ba8" +[[package]] +name = "array_tool" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f8cb5d814eb646a863c4f24978cff2880c4be96ad8cde2c0f0678732902e271" + [[package]] name = "arrayref" version = "0.3.6" @@ -116,6 +147,19 @@ dependencies = [ "futures-core", ] +[[package]] +name = "async-compression" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b72c1f1154e234325b50864a349b9c8e56939e266a4c307c0f159812df2f9537" +dependencies = [ + "bytes 0.5.6", + "flate2", + "futures-core", + "memchr", + "pin-project-lite 0.2.4", +] + [[package]] name = "async-executor" version = "1.4.0" @@ -528,6 +572,43 @@ dependencies = [ "yaml-rust", ] +[[package]] +name = "console" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7cc80946b3480f421c2f17ed1cb841753a371c7c5104f51d507e13f532c856aa" +dependencies = [ + "encode_unicode", + "lazy_static", + "libc", + "regex", + "terminal_size", + "unicode-width", + "winapi 0.3.9", +] + +[[package]] +name = "const-random" +version = "0.1.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f590d95d011aa80b063ffe3253422ed5aa462af4e9867d43ce8337562bac77c4" +dependencies = [ + "const-random-macro", + "proc-macro-hack", +] + +[[package]] +name = "const-random-macro" +version = "0.1.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "615f6e27d000a2bffbc7f2f6a8669179378fa27ee4d0a509e985dfc0a7defb40" +dependencies = [ + "getrandom 0.2.1", + "lazy_static", + "proc-macro-hack", + "tiny-keccak", +] + [[package]] name = "const_fn" version = "0.4.5" @@ -676,6 +757,12 @@ dependencies = [ "lazy_static", ] +[[package]] +name = "crunchy" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" + [[package]] name = "crypto-mac" version = "0.8.0" @@ -727,6 +814,17 @@ dependencies = [ "cipher", ] +[[package]] +name = "dashmap" +version = "3.11.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0f260e2fc850179ef410018660006951c1b55b79e8087e87111a2c388994b9b5" +dependencies = [ + "ahash", + "cfg-if 0.1.10", + "num_cpus", +] + [[package]] name = "data-encoding" version = "2.3.1" @@ -789,6 +887,16 @@ dependencies = [ "dirs-sys", ] +[[package]] +name = "dirs-next" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b98cf8ebf19c3d1b223e151f99a4f9f0690dca41414773390fc824184ac833e1" +dependencies = [ + "cfg-if 1.0.0", + "dirs-sys-next", +] + [[package]] name = "dirs-sys" version = "0.3.5" @@ -800,6 +908,17 @@ dependencies = [ "winapi 0.3.9", ] +[[package]] +name = "dirs-sys-next" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "99de365f605554ae33f115102a02057d4fc18b01f3284d6870be0938743cfe7d" +dependencies = [ + "libc", + "redox_users", + "winapi 0.3.9", +] + [[package]] name = "discard" version = "1.0.4" @@ -817,6 +936,12 @@ dependencies = [ "syn", ] +[[package]] +name = "doc-comment" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fea41bba32d969b513997752735605054bc0dfa92b4c56bf1189f2e174be7a10" + [[package]] name = "downcast" version = "0.10.0" @@ -829,12 +954,46 @@ version = "0.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "88d7ed2934d741c6b37e33e3832298e8850b53fd2d2bea03873375596c7cea4e" +[[package]] +name = "e2e" +version = "0.0.0" +dependencies = [ + "anyhow", + "async-trait", + "chrono", + "config", + "console", + "futures", + "indicatif", + "influxdb", + "k8s-openapi", + "kube", + "kube-runtime", + "reqwest", + "serde 1.0.120", + "serde_json", + "serde_yaml", + "tokio", + "toml", + "tracing", + "tracing-subscriber", + "xaynet-core", + "xaynet-sdk", + "xaynet-server", +] + [[package]] name = "either" version = "1.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457" +[[package]] +name = "encode_unicode" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a357d28ed41a50f9c765dbfe56cbc04a64e53e5fc58ba79fbc34c10ef3df831f" + [[package]] name = "encoding_rs" version = "0.8.26" @@ -844,6 +1003,19 @@ dependencies = [ "cfg-if 1.0.0", ] +[[package]] +name = "env_logger" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44533bbbb3bb3c1fa17d9f2e4e38bbbaf8396ba82193c4cb1b6445d711445d36" +dependencies = [ + "atty", + "humantime", + "log", + "regex", + "termcolor", +] + [[package]] name = "event-listener" version = "2.5.1" @@ -900,6 +1072,18 @@ dependencies = [ "log", ] +[[package]] +name = "flate2" +version = "1.0.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7411863d55df97a419aa64cb4d2f167103ea9d767e2c54a1868b7ac3f6b47129" +dependencies = [ + "cfg-if 1.0.0", + "crc32fast", + "libc", + "miniz_oxide", +] + [[package]] name = "float-cmp" version = "0.8.0" @@ -1317,6 +1501,15 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "494b4d60369511e7dea41cf646832512a94e542f68bb9c49e54518e0f468eb47" +[[package]] +name = "humantime" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df004cfca50ef23c36850aaaa59ad52cc70d0e90243c3c7737a4dd32dc7a3c4f" +dependencies = [ + "quick-error", +] + [[package]] name = "hyper" version = "0.13.9" @@ -1397,6 +1590,18 @@ dependencies = [ "hashbrown", ] +[[package]] +name = "indicatif" +version = "0.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7baab56125e25686df467fe470785512329883aab42696d661247aca2a2896e4" +dependencies = [ + "console", + "lazy_static", + "number_prefix", + "regex", +] + [[package]] name = "infer" version = "0.2.3" @@ -1476,6 +1681,33 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "jsonpath_lib" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61352ec23883402b7d30b3313c16cbabefb8907361c4eb669d990cbb87ceee5a" +dependencies = [ + "array_tool", + "env_logger", + "log", + "serde 1.0.120", + "serde_json", +] + +[[package]] +name = "k8s-openapi" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dcaa8ea719de24e21fe6fddb2ea996ca4e312d467c119f827551c4768d97dc5c" +dependencies = [ + "base64 0.13.0", + "bytes 0.5.6", + "chrono", + "serde 1.0.120", + "serde-value", + "serde_json", +] + [[package]] name = "kernel32-sys" version = "0.2.2" @@ -1486,6 +1718,55 @@ dependencies = [ "winapi-build", ] +[[package]] +name = "kube" +version = "0.46.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dac4a6cb38157d0c326ba0ab48c4daa7ef92a0ec223e6c2be68ea8c14c3d7e84" +dependencies = [ + "Inflector", + "base64 0.12.3", + "bytes 0.5.6", + "chrono", + "dirs-next", + "either", + "futures", + "futures-util", + "http", + "jsonpath_lib", + "k8s-openapi", + "log", + "openssl", + "pem", + "reqwest", + "serde 1.0.120", + "serde_json", + "serde_yaml", + "static_assertions", + "thiserror", + "time 0.2.24", + "tokio", + "url", +] + +[[package]] +name = "kube-runtime" +version = "0.46.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "efbf94071a4f9f987b058bd71bf96deed5a1d438b1c7778b120e0a759640bf5d" +dependencies = [ + "dashmap", + "derivative", + "futures", + "k8s-openapi", + "kube", + "pin-project 0.4.27", + "serde 1.0.120", + "smallvec", + "snafu", + "tokio", +] + [[package]] name = "kv-log-macro" version = "1.0.7" @@ -1617,6 +1898,16 @@ dependencies = [ "unicase", ] +[[package]] +name = "miniz_oxide" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0f2d26ec3309788e423cfbf68ad1800f061638098d76a83681af979dc4eda19d" +dependencies = [ + "adler", + "autocfg", +] + [[package]] name = "mio" version = "0.6.23" @@ -1902,6 +2193,12 @@ dependencies = [ "syn", ] +[[package]] +name = "number_prefix" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "17b02fc0ff9a9e4b35b3342880f48e896ebf69f2967921fe8646bf5b7125956a" + [[package]] name = "once_cell" version = "1.5.2" @@ -1959,6 +2256,15 @@ dependencies = [ "vcpkg", ] +[[package]] +name = "ordered-float" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dacdec97876ef3ede8c50efc429220641a0b11ba0048b4b0c357bccbc47c5204" +dependencies = [ + "num-traits 0.2.14", +] + [[package]] name = "parking" version = "2.0.0" @@ -1996,6 +2302,17 @@ version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c5d65c4d95931acda4498f675e332fcbdc9a06705cd07086c510e9b6009cd1c1" +[[package]] +name = "pem" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f4c220d01f863d13d96ca82359d1e81e64a7c6bf0637bcde7b2349630addf0c6" +dependencies = [ + "base64 0.13.0", + "once_cell", + "regex", +] + [[package]] name = "percent-encoding" version = "2.1.0" @@ -2403,6 +2720,7 @@ version = "0.10.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0718f81a8e14c4dbb3b34cf23dc6aaf9ab8a0dfec160c534b3dbca1aaa21f47c" dependencies = [ + "async-compression", "base64 0.13.0", "bytes 0.5.6", "encoding_rs", @@ -2412,19 +2730,23 @@ dependencies = [ "http-body", "hyper", "hyper-rustls", + "hyper-tls", "ipnet", "js-sys", "lazy_static", "log", "mime", "mime_guess", + "native-tls", "percent-encoding", "pin-project-lite 0.2.4", "rustls", "serde 1.0.120", + "serde_json", "serde_urlencoded 0.7.0", "tokio", "tokio-rustls", + "tokio-tls", "url", "wasm-bindgen", "wasm-bindgen-futures", @@ -2693,6 +3015,16 @@ dependencies = [ "serde 0.8.23", ] +[[package]] +name = "serde-value" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3a1a3341211875ef120e117ea7fd5228530ae7e7036a779fdc9117be6b3282c" +dependencies = [ + "ordered-float", + "serde 1.0.120", +] + [[package]] name = "serde_cbor" version = "0.11.1" @@ -2720,6 +3052,7 @@ version = "1.0.61" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4fceb2595057b6891a4ee808f70054bd2d12f0e97f1cbb78689b59f676df325a" dependencies = [ + "indexmap", "itoa", "ryu", "serde 1.0.120", @@ -2770,6 +3103,18 @@ dependencies = [ "serde 1.0.120", ] +[[package]] +name = "serde_yaml" +version = "0.8.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "971be8f6e4d4a47163b405a3df70d14359186f9ab0f3a3ec37df144ca1ce089f" +dependencies = [ + "dtoa", + "linked-hash-map 0.5.4", + "serde 1.0.120", + "yaml-rust", +] + [[package]] name = "serial_test" version = "0.5.1" @@ -2872,6 +3217,29 @@ version = "1.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fe0f37c9e8f3c5a4a66ad655a93c74daac4ad00c441533bf5c6e7990bb42604e" +[[package]] +name = "snafu" +version = "0.6.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eab12d3c261b2308b0d80c26fffb58d17eba81a4be97890101f416b478c79ca7" +dependencies = [ + "doc-comment", + "futures-core", + "pin-project 0.4.27", + "snafu-derive", +] + +[[package]] +name = "snafu-derive" +version = "0.6.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1508efa03c362e23817f96cde18abed596a25219a8b2c66e8db33c03543d315b" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "socket2" version = "0.3.19" @@ -3045,6 +3413,25 @@ dependencies = [ "winapi 0.3.9", ] +[[package]] +name = "termcolor" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2dfed899f0eb03f32ee8c6a0aabdb8a7949659e3466561fc0adf54e26d88c5f4" +dependencies = [ + "winapi-util", +] + +[[package]] +name = "terminal_size" +version = "0.1.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4bd2d183bd3fac5f5fe38ddbeb4dc9aec4a39a9d7d59e7491d900302da01cbe1" +dependencies = [ + "libc", + "winapi 0.3.9", +] + [[package]] name = "textwrap" version = "0.11.0" @@ -3132,6 +3519,15 @@ dependencies = [ "syn", ] +[[package]] +name = "tiny-keccak" +version = "2.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c9d3793400a45f954c52e73d068316d76b6f4e36977e3fcebb13a2721e80237" +dependencies = [ + "crunchy", +] + [[package]] name = "tinytemplate" version = "1.2.0" diff --git a/rust/e2e/Cargo.toml b/rust/e2e/Cargo.toml index 5a8662a5e..2452a00d4 100644 --- a/rust/e2e/Cargo.toml +++ b/rust/e2e/Cargo.toml @@ -19,7 +19,7 @@ msrv = "1.46.0" async-trait = "0.1.42" anyhow = "1.0.38" futures = "0.3.12" -serde = { version = "1.0.119", features = ["derive"] } +serde = { version = "1.0.120", features = ["derive"] } serde_yaml = "0.8.15" tokio = { version = "0.2.24", features = ["full"] } reqwest = { version = "0.10.10", default-features = false, features = ["json", "gzip", "stream"] } @@ -33,8 +33,8 @@ indicatif = "0.15.0" influxdb = "0.3.0" chrono = { version = "0.4.19" } toml = "0.5" -kube = { version = "0.43.0" } -kube-runtime = { version = "0.43.0" } -k8s-openapi = { version = "0.9.0", default-features = false, features = ["v1_16"] } +kube = { version = "0.46.1" } +kube-runtime = { version = "0.46.1" } +k8s-openapi = { version = "0.10.0", default-features = false, features = ["v1_16"] } serde_json = { version = "1.0.61" } -console = "0.13" +console = "0.14" diff --git a/rust/e2e/src/bin/test_case_1/config.toml b/rust/e2e/src/bin/test_case_1/config.toml index 28b002b2b..5912aa516 100644 --- a/rust/e2e/src/bin/test_case_1/config.toml +++ b/rust/e2e/src/bin/test_case_1/config.toml @@ -7,9 +7,9 @@ tls_certificate = "/app/ssl/tls.pem" tls_key = "/app/ssl/tls.key" [pet] -min_sum_count = 1 +min_sum_count = 10 min_update_count = 3 -min_sum2_count = 1 +min_sum2_count = 5 max_sum_count = 100 max_update_count = 10000 max_sum2_count = 100 diff --git a/rust/e2e/src/test_client/builder.rs b/rust/e2e/src/test_client/builder.rs index 20e0ac849..02fc682b6 100644 --- a/rust/e2e/src/test_client/builder.rs +++ b/rust/e2e/src/test_client/builder.rs @@ -15,6 +15,7 @@ use xaynet_sdk::{client::Client as ApiClient, StateMachine, XaynetClient}; pub struct TestClientBuilderSettings { number_of_sum: u64, number_of_update: u64, + number_of_sum2: u64, model_length: usize, } @@ -25,6 +26,7 @@ impl TestClientBuilderSettings { Self { number_of_sum: coordinator_settings.pet.min_sum_count, number_of_update: coordinator_settings.pet.min_update_count, + number_of_sum2: coordinator_settings.pet.min_sum2_count, model_length: coordinator_settings.model.length, } } @@ -124,6 +126,10 @@ impl TestClientBuilder { }) .await?; - Ok(ClientRunner::new(sum_clients, update_clients)) + Ok(ClientRunner::new( + sum_clients, + update_clients, + self.settings.number_of_sum2, + )) } } diff --git a/rust/e2e/src/test_client/runner.rs b/rust/e2e/src/test_client/runner.rs index 69d4e886d..688e5be6d 100644 --- a/rust/e2e/src/test_client/runner.rs +++ b/rust/e2e/src/test_client/runner.rs @@ -14,6 +14,7 @@ pub struct ClientRunner { Option)>>>, sum2_clients: Option)>>>, + sum2_count: u64, } impl ClientRunner { @@ -24,11 +25,13 @@ impl ClientRunner { update_clients: ConcurrentFutures< BoxFuture<'static, (StateMachine, mpsc::Receiver)>, >, + sum2_count: u64, ) -> Self { Self { sum_clients: Some(sum_clients), update_clients: Some(update_clients), sum2_clients: None, + sum2_count, } } @@ -42,8 +45,12 @@ impl ClientRunner { .take() .ok_or_else(|| anyhow::anyhow!("No sum clients available"))?; + let mut summer2 = 0; while let Some(sum_client) = sum_clients.next().await { - sum2_clients.push(sum_client?); + if summer2 < self.sum2_count { + sum2_clients.push(sum_client?); + summer2 += 1; + } } self.sum2_clients = Some(sum2_clients);