Compare commits

...

6 Commits

Author SHA1 Message Date
brotoskyj 1aae27b0f4 Changed File so Build Activates
Build Library / Build Library (push) Failing after 1m22s
2026-01-05 10:12:43 -05:00
brotoskyj 663dbc3cc2 Changed YAML Build File 2026-01-05 10:11:50 -05:00
brotoskyj d2d181de4a Removed old crate imports 2026-01-05 10:08:41 -05:00
brotoskyj 31d45ca1db Styling - Progress Bar
Changed glyphs in progress bar for better printing to console
closes #51
2025-12-22 12:42:59 -05:00
brotoskyj a086956b48 Features - Optional Policy Name in Execution Histories
closes #48
2025-12-22 12:42:59 -05:00
brotoskyj 76cfe62f08 Styling - Progress Bar
Changed progress bar indicators and added policy name to the progress bar
closes #50
2025-12-22 12:42:59 -05:00
6 changed files with 28 additions and 16 deletions
+2 -2
View File
@@ -2,8 +2,8 @@ name: Build Library
run-name: ${{ gitea.actor }}
on:
push:
branches:
- RustImplementation
branches-ignore:
- master
paths:
- airlock_libs/**
+1 -1
View File
@@ -26,7 +26,7 @@ dependencies = [
[[package]]
name = "airlock_libs"
version = "6.1.1"
version = "7.2.0"
dependencies = [
"chrono",
"crossbeam",
+1 -1
View File
@@ -1,6 +1,6 @@
[package]
name = "airlock_libs"
version = "6.1.1"
version = "7.2.0"
edition = "2024"
[dependencies]
+1 -1
View File
@@ -4,7 +4,7 @@ build-backend = "maturin"
[project]
name = "airlock_libs"
version = "6.1.1"
version = "7.2.0"
description = "Airlock Digital API Wrapper"
readme = "README.md"
license = { text = "AGPL-3.0-only" }
+22 -10
View File
@@ -1,8 +1,7 @@
use serde_json::json;
use crate::modules::datatypes::*;
use crate::prelude::*;
#[pyfunction]
pub fn pull_policy_exec_histories(
py: Python<'_>,
@@ -75,8 +74,8 @@ pub fn pull_policy_exec_histories(
.set_draw_target(ProgressDrawTarget::stderr());
progress_bar.lock().unwrap().set_style(
ProgressStyle::default_bar()
.template("Total Completion: {spinner:.green} [{elapsed_precise}] [{bar:40.green/blue}] {pos}/{len} {message}")
.unwrap(),
.template("Total - Policy Name: {msg}: {spinner:.green} [{elapsed_precise}] [{bar:40.green/blue}] {pos}/{len}")
.unwrap().progress_chars("⣿⣦⣀")
);
let client: Client = tracer.in_span("Building HTTP Client", |cx| {
let client_result: Result<Client, reqwest::Error> = build_client(headers);
@@ -181,11 +180,17 @@ pub fn pull_policy_exec_histories(
.lock()
.unwrap()
.enable_steady_tick(std::time::Duration::from_millis(100));
pb_clone
.lock()
.unwrap()
.set_message(policy_names.clone().unwrap_or("Statistics".to_string()));
let span: opentelemetry::trace::SpanRef<'_> = cx.span();
span.set_attribute(KeyValue::new("Days", days.to_string()));
span.set_attribute(KeyValue::new(
"Policy Name",
policy_names.clone().unwrap_or_default(),
policy_names
.clone()
.unwrap_or("Statistics Monitoring".to_string()),
));
loop {
let execution_histories = tracer.in_span(checkpoint_number.to_string(), |cx| {
@@ -267,11 +272,18 @@ async fn history_logging(
policy_names: &Option<String>,
client: &Client,
) -> ApiResponse {
let payload = json!({
"type": exec_types,
"checkpoint": checkpoint_number,
"policy": policy_names.as_ref().map(|p| vec![p]),
});
let policy_json = match policy_names {
Some(name) => format!(r#"[ "{}" ]"#, name), // JSON array with one element
None => "[]".to_string(), // Empty JSON array
};
let payload = format!(
r#"{{
"type": {},
"checkpoint": "{}",
"policy": {}
}}"#,
exec_types, checkpoint_number, policy_json
);
let res: Result<reqwest::Response, reqwest::Error> = client
.post(format!("{}/v1/logging/exechistories", base_url))
.json(&payload)
+1 -1
View File
@@ -23,4 +23,4 @@ pyperclip==1.11.0
# Custom/Private packages
--extra-index-url https://git.racooncity.org/api/packages/brotoskyj/pypi/simple/
airlock_libs==6.1.1
airlock_libs==7.2.0