From 2efb6dc82c464292ecbb9ce7278c767a8ef43755 Mon Sep 17 00:00:00 2001 From: Gusto Date: Fri, 8 Sep 2023 13:56:53 +0300 Subject: [PATCH 1/5] Remove explicit target --- .github/workflows/pr.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 210d352f9..b8aace4f0 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -52,7 +52,6 @@ jobs: with: profile: minimal toolchain: stable-gnu - target: x86_64-pc-windows-gnu override: true # Setup Rust toolchain for other OSes - name: Setup Rust toolchain (Other OSes) From d2167ae2280bf6481dfb43d5aa40115671c8f97d Mon Sep 17 00:00:00 2001 From: Gusto Date: Fri, 8 Sep 2023 14:57:08 +0300 Subject: [PATCH 2/5] Use default profile for windows build --- .github/workflows/pr.yml | 7 ------- 1 file changed, 7 deletions(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index b8aace4f0..6c91106f1 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -50,7 +50,6 @@ jobs: if: matrix.os == 'windows-latest' uses: actions-rs/toolchain@v1 with: - profile: minimal toolchain: stable-gnu override: true # Setup Rust toolchain for other OSes @@ -65,12 +64,6 @@ jobs: with: command: build args: --all --no-default-features --features ${{ matrix.feature }} - # Freeup some space for Windows tests - - name: Clean target dir (Windows) - if: matrix.os == 'windows-latest' - uses: actions-rs/cargo@v1 - with: - command: clean - uses: actions-rs/cargo@v1 with: command: test From 428dc066bf977b9a4b8431c82e6467457103057d Mon Sep 17 00:00:00 2001 From: Gusto Date: Mon, 11 Sep 2023 12:00:32 +0300 Subject: [PATCH 3/5] Use stable-gnu for tests --- .github/workflows/pr.yml | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 6c91106f1..5a8adb10e 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -52,6 +52,13 @@ jobs: with: toolchain: stable-gnu override: true + target: x86_64-pc-windows-gnu + - name: Comment out simulations in Cargo.toml (Windows) + if: matrix.os == 'windows-latest' + run: | + $content = Get-Content Cargo.toml + $content | ForEach-Object { $_ -replace '^simulations', '#simulations' } | Set-Content Cargo.toml + shell: powershell # Setup Rust toolchain for other OSes - name: Setup Rust toolchain (Other OSes) if: matrix.os != 'windows-latest' @@ -64,6 +71,12 @@ jobs: with: command: build args: --all --no-default-features --features ${{ matrix.feature }} + - uses: actions-rs/toolchain@v1 + if: matrix.os == 'windows-latest' + with: + toolchain: stable-gnu + override: true + target: x86_64-pc-windows-gnu - uses: actions-rs/cargo@v1 with: command: test From 449e9130a7588779a4b600b795ff9131bfb0fad7 Mon Sep 17 00:00:00 2001 From: Gusto Date: Mon, 11 Sep 2023 13:41:35 +0300 Subject: [PATCH 4/5] Make polars optional feature in simulations --- simulations/Cargo.toml | 7 +++++-- simulations/src/bin/app/main.rs | 7 ++++--- simulations/src/bin/app/overlay_node.rs | 1 + simulations/src/node/carnot/timeout.rs | 3 +++ simulations/src/streaming/mod.rs | 5 +++++ 5 files changed, 18 insertions(+), 5 deletions(-) diff --git a/simulations/Cargo.toml b/simulations/Cargo.toml index 88ecdf102..13f159584 100644 --- a/simulations/Cargo.toml +++ b/simulations/Cargo.toml @@ -28,7 +28,7 @@ nomos-core = { path = "../nomos-core" } nomos-consensus = { path = "../nomos-services/consensus" } once_cell = "1.17" parking_lot = "0.12" -polars = { version = "0.27", features = ["serde", "object", "json", "csv-file", "parquet", "dtype-struct"] } +polars = { version = "0.27", features = ["serde", "object", "json", "csv-file", "parquet", "dtype-struct"], optional = true } rand = { version = "0.8", features = ["small_rng"] } rayon = "1.7" scopeguard = "1" @@ -43,4 +43,7 @@ tracing-subscriber = { version = "0.3", features = ["env-filter", "tracing-log"] getrandom = { version = "0.2", features = ["js"] } [dev-dependencies] -tempfile = "3.4" \ No newline at end of file +tempfile = "3.4" + +[features] +polars = ["dep:polars"] diff --git a/simulations/src/bin/app/main.rs b/simulations/src/bin/app/main.rs index 302b83ecf..ae1749ae8 100644 --- a/simulations/src/bin/app/main.rs +++ b/simulations/src/bin/app/main.rs @@ -23,9 +23,9 @@ use simulations::node::carnot::{CarnotRecord, CarnotSettings, CarnotState}; use simulations::node::{NodeId, NodeIdExt}; use simulations::output_processors::Record; use simulations::runner::{BoxedNode, SimulationRunnerHandle}; -use simulations::streaming::{ - io::IOSubscriber, naive::NaiveSubscriber, polars::PolarsSubscriber, StreamType, -}; +#[cfg(feature = "polars")] +use simulations::streaming::polars::PolarsSubscriber; +use simulations::streaming::{io::IOSubscriber, naive::NaiveSubscriber, StreamType}; // internal use simulations::{runner::SimulationRunner, settings::SimulationSettings}; mod log; @@ -163,6 +163,7 @@ where let settings = stream_settings.unwrap_io(); runner.simulate_and_subscribe::>(settings)? } + #[cfg(feature = "polars")] Some(StreamType::Polars) => { let settings = stream_settings.unwrap_polars(); runner.simulate_and_subscribe::>(settings)? diff --git a/simulations/src/bin/app/overlay_node.rs b/simulations/src/bin/app/overlay_node.rs index 7389d671e..ad7f4efb8 100644 --- a/simulations/src/bin/app/overlay_node.rs +++ b/simulations/src/bin/app/overlay_node.rs @@ -25,6 +25,7 @@ pub fn to_overlay_node( simulations::streaming::StreamSettings::IO(_) => { simulations::streaming::SubscriberFormat::Csv } + #[cfg(feature = "polars")] simulations::streaming::StreamSettings::Polars(p) => p.format, }; match &settings.overlay_settings { diff --git a/simulations/src/node/carnot/timeout.rs b/simulations/src/node/carnot/timeout.rs index c3fb67ba7..0e5683c8c 100644 --- a/simulations/src/node/carnot/timeout.rs +++ b/simulations/src/node/carnot/timeout.rs @@ -1,5 +1,8 @@ use consensus_engine::View; +#[cfg(feature = "polars")] use polars::export::ahash::HashMap; +#[cfg(not(feature = "polars"))] +use std::collections::HashMap; use std::time::Duration; pub(crate) struct TimeoutHandler { diff --git a/simulations/src/streaming/mod.rs b/simulations/src/streaming/mod.rs index 2ca6d79fc..946cf9406 100644 --- a/simulations/src/streaming/mod.rs +++ b/simulations/src/streaming/mod.rs @@ -11,6 +11,7 @@ use crate::output_processors::{Record, RecordType, Runtime}; pub mod io; pub mod naive; +#[cfg(feature = "polars")] pub mod polars; pub mod runtime_subscriber; pub mod settings_subscriber; @@ -83,6 +84,7 @@ pub enum StreamType { #[default] IO, Naive, + #[cfg(feature = "polars")] Polars, } @@ -93,6 +95,7 @@ impl FromStr for StreamType { match s.trim().to_ascii_lowercase().as_str() { "io" => Ok(Self::IO), "naive" => Ok(Self::Naive), + #[cfg(feature = "polars")] "polars" => Ok(Self::Polars), tag => Err(format!( "Invalid {tag} streaming type, only [naive, polars] are supported", @@ -116,6 +119,7 @@ impl<'de> serde::Deserialize<'de> for StreamType { pub enum StreamSettings { Naive(naive::NaiveSettings), IO(io::IOStreamSettings), + #[cfg(feature = "polars")] Polars(polars::PolarsSettings), } @@ -140,6 +144,7 @@ impl StreamSettings { } } + #[cfg(feature = "polars")] pub fn unwrap_polars(self) -> polars::PolarsSettings { match self { StreamSettings::Polars(settings) => settings, From 2e88f222478772816c71b726c402fe08e0b95a09 Mon Sep 17 00:00:00 2001 From: Gusto Date: Mon, 11 Sep 2023 14:05:31 +0300 Subject: [PATCH 5/5] Remove unnecessary ci debug steps --- .github/workflows/master.yml | 7 ------- .github/workflows/pr.yml | 14 +------------- 2 files changed, 1 insertion(+), 20 deletions(-) diff --git a/.github/workflows/master.yml b/.github/workflows/master.yml index 115346857..b2ff0d9d5 100644 --- a/.github/workflows/master.yml +++ b/.github/workflows/master.yml @@ -49,7 +49,6 @@ jobs: if: matrix.os == 'windows-latest' uses: actions-rs/toolchain@v1 with: - profile: minimal toolchain: stable-gnu target: x86_64-pc-windows-gnu override: true @@ -65,12 +64,6 @@ jobs: with: command: build args: --all --no-default-features --features ${{ matrix.feature }} - # Freeup some space for Windows tests - - name: Clean target dir (Windows) - if: matrix.os == 'windows-latest' - uses: actions-rs/cargo@v1 - with: - command: clean - uses: actions-rs/cargo@v1 with: command: test diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 5a8adb10e..06fc51e78 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -51,14 +51,8 @@ jobs: uses: actions-rs/toolchain@v1 with: toolchain: stable-gnu - override: true target: x86_64-pc-windows-gnu - - name: Comment out simulations in Cargo.toml (Windows) - if: matrix.os == 'windows-latest' - run: | - $content = Get-Content Cargo.toml - $content | ForEach-Object { $_ -replace '^simulations', '#simulations' } | Set-Content Cargo.toml - shell: powershell + override: true # Setup Rust toolchain for other OSes - name: Setup Rust toolchain (Other OSes) if: matrix.os != 'windows-latest' @@ -71,12 +65,6 @@ jobs: with: command: build args: --all --no-default-features --features ${{ matrix.feature }} - - uses: actions-rs/toolchain@v1 - if: matrix.os == 'windows-latest' - with: - toolchain: stable-gnu - override: true - target: x86_64-pc-windows-gnu - uses: actions-rs/cargo@v1 with: command: test