From 954aa24b375341c96b3d008587bf882f35f430d8 Mon Sep 17 00:00:00 2001 From: brotoskyj Date: Thu, 6 Nov 2025 15:34:53 -0500 Subject: [PATCH 1/4] Removed +10 Days Counter --- airlock_libs/src/services.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/airlock_libs/src/services.rs b/airlock_libs/src/services.rs index 5056344..26488e4 100644 --- a/airlock_libs/src/services.rs +++ b/airlock_libs/src/services.rs @@ -15,7 +15,7 @@ use std::{ fs::{self, File}, io::Read, path::PathBuf, - str::FromStr, + str::FromStr, sync::mpsc::{Sender, Receiver, channel}, }; #[derive(Debug, Deserialize, Serialize)] @@ -96,7 +96,9 @@ pub fn pull_policy_exec_histories( let client = build_client(py, &py_self); let api: Py = py_self; let cutoff = Local::now().naive_local() - Duration::days(days); + let (tx, rx):(Sender, Receiver) = channel(); loop { + let thread_tx = tx.clone(); let execution_histories = history_logging( py, &api, @@ -178,7 +180,7 @@ pub fn pull_policy_exec_histories( { let date_diff = Local::now().naive_local().date() - last_date; let percentage_diff = - ((days + 10) - date_diff.num_days()) as f64 / (days + 10) as f64 * 100.0; + (days - date_diff.num_days()) as f64 / days as f64 * 100.0; progress_bar.set_position(percentage_diff.round() as u64); progress_bar.set_message("Total Percent Complete"); } From 4facceb75b09541e16cc21cae345d4a603700d58 Mon Sep 17 00:00:00 2001 From: brotoskyj Date: Thu, 6 Nov 2025 16:47:28 -0500 Subject: [PATCH 2/4] Version 2.0.0 - Memory Optimization --- airlock_libs/Cargo.lock | 2 +- airlock_libs/Cargo.toml | 2 +- airlock_libs/pyproject.toml | 2 +- airlock_libs/src/services.rs | 12 +++++------- requirements.txt | 2 +- 5 files changed, 9 insertions(+), 11 deletions(-) diff --git a/airlock_libs/Cargo.lock b/airlock_libs/Cargo.lock index 70327a0..a3d9b52 100644 --- a/airlock_libs/Cargo.lock +++ b/airlock_libs/Cargo.lock @@ -17,7 +17,7 @@ dependencies = [ [[package]] name = "airlock_libs" -version = "1.0.3" +version = "2.0.0" dependencies = [ "chrono", "indicatif", diff --git a/airlock_libs/Cargo.toml b/airlock_libs/Cargo.toml index 15f8786..3a853d9 100644 --- a/airlock_libs/Cargo.toml +++ b/airlock_libs/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "airlock_libs" -version = "1.0.3" +version = "2.0.0" edition = "2024" [lib] diff --git a/airlock_libs/pyproject.toml b/airlock_libs/pyproject.toml index 2f78abd..e7cd8aa 100644 --- a/airlock_libs/pyproject.toml +++ b/airlock_libs/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "maturin" [project] name = "airlock_libs" -version = "1.0.3" +version = "2.0.0" description = "Airlock Digital API Wrapper" readme = "README.md" license = { text = "AGPL-3.0-only" } diff --git a/airlock_libs/src/services.rs b/airlock_libs/src/services.rs index 26488e4..8870d5c 100644 --- a/airlock_libs/src/services.rs +++ b/airlock_libs/src/services.rs @@ -13,9 +13,9 @@ use std::{ env, fmt::Write, fs::{self, File}, - io::Read, + io::{Read, Seek, SeekFrom}, path::PathBuf, - str::FromStr, sync::mpsc::{Sender, Receiver, channel}, + str::FromStr, }; #[derive(Debug, Deserialize, Serialize)] @@ -96,9 +96,9 @@ pub fn pull_policy_exec_histories( let client = build_client(py, &py_self); let api: Py = py_self; let cutoff = Local::now().naive_local() - Duration::days(days); - let (tx, rx):(Sender, Receiver) = channel(); + let mut f = File::open(&writeable_filepath).unwrap(); loop { - let thread_tx = tx.clone(); + f.seek(SeekFrom::Start(0)).unwrap(); let execution_histories = history_logging( py, &api, @@ -112,7 +112,6 @@ pub fn pull_policy_exec_histories( break; } let mut seen: HashMap<(String, String, String), Group> = if writeable_filepath.exists() { - let mut f = File::open(&writeable_filepath).unwrap(); let mut contents = String::new(); f.read_to_string(&mut contents).unwrap(); let existing_data: ApiResponse = @@ -179,8 +178,7 @@ pub fn pull_policy_exec_histories( ) { let date_diff = Local::now().naive_local().date() - last_date; - let percentage_diff = - (days - date_diff.num_days()) as f64 / days as f64 * 100.0; + let percentage_diff = (days - date_diff.num_days()) as f64 / days as f64 * 100.0; progress_bar.set_position(percentage_diff.round() as u64); progress_bar.set_message("Total Percent Complete"); } diff --git a/requirements.txt b/requirements.txt index 34abeed..1141830 100644 --- a/requirements.txt +++ b/requirements.txt @@ -10,4 +10,4 @@ tqdm==4.67.1 urllib3==2.5.0 --extra-index-url https://git.racooncity.org/api/packages/brotoskyj/pypi/simple/ -airlock_libs==1.0.3 \ No newline at end of file +airlock_libs==2.0.0 \ No newline at end of file From 129a72158087b04beb6746697672547a23e7ff43 Mon Sep 17 00:00:00 2001 From: brotoskyj Date: Thu, 6 Nov 2025 16:51:37 -0500 Subject: [PATCH 3/4] Removed tag because I think it broke the CICD Pipeline --- airlock_libs/airlock_libs.pyi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/airlock_libs/airlock_libs.pyi b/airlock_libs/airlock_libs.pyi index 137dc92..84bee85 100644 --- a/airlock_libs/airlock_libs.pyi +++ b/airlock_libs/airlock_libs.pyi @@ -30,7 +30,7 @@ def history_logging( checkpoint_number: str, policy_names: str, ) -> List[Dict[str, Any]]: - """ + """ Query execution history logs from the Airlock API. Parameters From 69c9e7a51f026da44e7083a93936ebf911ccd62e Mon Sep 17 00:00:00 2001 From: brotoskyj Date: Thu, 6 Nov 2025 16:53:02 -0500 Subject: [PATCH 4/4] Noticed Typo in YAML --- .gitea/workflows/loxide_lib.yml | 2 +- airlock_libs/airlock_libs.pyi | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitea/workflows/loxide_lib.yml b/.gitea/workflows/loxide_lib.yml index a49b143..0a21747 100644 --- a/.gitea/workflows/loxide_lib.yml +++ b/.gitea/workflows/loxide_lib.yml @@ -2,7 +2,7 @@ name: Build Library run-name: ${{ gitea.actor }} on: push: - braches: + branches: - RustImplementation paths: - airlock_libs/** diff --git a/airlock_libs/airlock_libs.pyi b/airlock_libs/airlock_libs.pyi index 84bee85..137dc92 100644 --- a/airlock_libs/airlock_libs.pyi +++ b/airlock_libs/airlock_libs.pyi @@ -30,7 +30,7 @@ def history_logging( checkpoint_number: str, policy_names: str, ) -> List[Dict[str, Any]]: - """ + """ Query execution history logs from the Airlock API. Parameters