Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 1aae27b0f4 | |||
| 663dbc3cc2 | |||
| d2d181de4a | |||
| 31d45ca1db | |||
| a086956b48 | |||
| 76cfe62f08 |
@@ -2,8 +2,8 @@ name: Build Library
|
|||||||
run-name: ${{ gitea.actor }}
|
run-name: ${{ gitea.actor }}
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches-ignore:
|
||||||
- RustImplementation
|
- master
|
||||||
paths:
|
paths:
|
||||||
- airlock_libs/**
|
- airlock_libs/**
|
||||||
|
|
||||||
|
|||||||
Generated
+1
-1
@@ -26,7 +26,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "airlock_libs"
|
name = "airlock_libs"
|
||||||
version = "6.1.1"
|
version = "7.2.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"chrono",
|
"chrono",
|
||||||
"crossbeam",
|
"crossbeam",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "airlock_libs"
|
name = "airlock_libs"
|
||||||
version = "6.1.1"
|
version = "7.2.0"
|
||||||
edition = "2024"
|
edition = "2024"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ build-backend = "maturin"
|
|||||||
|
|
||||||
[project]
|
[project]
|
||||||
name = "airlock_libs"
|
name = "airlock_libs"
|
||||||
version = "6.1.1"
|
version = "7.2.0"
|
||||||
description = "Airlock Digital API Wrapper"
|
description = "Airlock Digital API Wrapper"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
license = { text = "AGPL-3.0-only" }
|
license = { text = "AGPL-3.0-only" }
|
||||||
|
|||||||
@@ -1,8 +1,7 @@
|
|||||||
use serde_json::json;
|
|
||||||
|
|
||||||
use crate::modules::datatypes::*;
|
use crate::modules::datatypes::*;
|
||||||
use crate::prelude::*;
|
use crate::prelude::*;
|
||||||
|
|
||||||
|
|
||||||
#[pyfunction]
|
#[pyfunction]
|
||||||
pub fn pull_policy_exec_histories(
|
pub fn pull_policy_exec_histories(
|
||||||
py: Python<'_>,
|
py: Python<'_>,
|
||||||
@@ -75,8 +74,8 @@ pub fn pull_policy_exec_histories(
|
|||||||
.set_draw_target(ProgressDrawTarget::stderr());
|
.set_draw_target(ProgressDrawTarget::stderr());
|
||||||
progress_bar.lock().unwrap().set_style(
|
progress_bar.lock().unwrap().set_style(
|
||||||
ProgressStyle::default_bar()
|
ProgressStyle::default_bar()
|
||||||
.template("Total Completion: {spinner:.green} [{elapsed_precise}] [{bar:40.green/blue}] {pos}/{len} {message}")
|
.template("Total - Policy Name: {msg}: {spinner:.green} [{elapsed_precise}] [{bar:40.green/blue}] {pos}/{len}")
|
||||||
.unwrap(),
|
.unwrap().progress_chars("⣿⣦⣀")
|
||||||
);
|
);
|
||||||
let client: Client = tracer.in_span("Building HTTP Client", |cx| {
|
let client: Client = tracer.in_span("Building HTTP Client", |cx| {
|
||||||
let client_result: Result<Client, reqwest::Error> = build_client(headers);
|
let client_result: Result<Client, reqwest::Error> = build_client(headers);
|
||||||
@@ -181,11 +180,17 @@ pub fn pull_policy_exec_histories(
|
|||||||
.lock()
|
.lock()
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.enable_steady_tick(std::time::Duration::from_millis(100));
|
.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();
|
let span: opentelemetry::trace::SpanRef<'_> = cx.span();
|
||||||
span.set_attribute(KeyValue::new("Days", days.to_string()));
|
span.set_attribute(KeyValue::new("Days", days.to_string()));
|
||||||
span.set_attribute(KeyValue::new(
|
span.set_attribute(KeyValue::new(
|
||||||
"Policy Name",
|
"Policy Name",
|
||||||
policy_names.clone().unwrap_or_default(),
|
policy_names
|
||||||
|
.clone()
|
||||||
|
.unwrap_or("Statistics Monitoring".to_string()),
|
||||||
));
|
));
|
||||||
loop {
|
loop {
|
||||||
let execution_histories = tracer.in_span(checkpoint_number.to_string(), |cx| {
|
let execution_histories = tracer.in_span(checkpoint_number.to_string(), |cx| {
|
||||||
@@ -267,11 +272,18 @@ async fn history_logging(
|
|||||||
policy_names: &Option<String>,
|
policy_names: &Option<String>,
|
||||||
client: &Client,
|
client: &Client,
|
||||||
) -> ApiResponse {
|
) -> ApiResponse {
|
||||||
let payload = json!({
|
let policy_json = match policy_names {
|
||||||
"type": exec_types,
|
Some(name) => format!(r#"[ "{}" ]"#, name), // JSON array with one element
|
||||||
"checkpoint": checkpoint_number,
|
None => "[]".to_string(), // Empty JSON array
|
||||||
"policy": policy_names.as_ref().map(|p| vec![p]),
|
};
|
||||||
});
|
let payload = format!(
|
||||||
|
r#"{{
|
||||||
|
"type": {},
|
||||||
|
"checkpoint": "{}",
|
||||||
|
"policy": {}
|
||||||
|
}}"#,
|
||||||
|
exec_types, checkpoint_number, policy_json
|
||||||
|
);
|
||||||
let res: Result<reqwest::Response, reqwest::Error> = client
|
let res: Result<reqwest::Response, reqwest::Error> = client
|
||||||
.post(format!("{}/v1/logging/exechistories", base_url))
|
.post(format!("{}/v1/logging/exechistories", base_url))
|
||||||
.json(&payload)
|
.json(&payload)
|
||||||
|
|||||||
+1
-1
@@ -23,4 +23,4 @@ pyperclip==1.11.0
|
|||||||
|
|
||||||
# Custom/Private packages
|
# Custom/Private packages
|
||||||
--extra-index-url https://git.racooncity.org/api/packages/brotoskyj/pypi/simple/
|
--extra-index-url https://git.racooncity.org/api/packages/brotoskyj/pypi/simple/
|
||||||
airlock_libs==6.1.1
|
airlock_libs==7.2.0
|
||||||
Reference in New Issue
Block a user