RustImplementation #49
Generated
+1
-1
@@ -26,7 +26,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "airlock_libs"
|
name = "airlock_libs"
|
||||||
version = "4.0.1"
|
version = "4.0.2"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"chrono",
|
"chrono",
|
||||||
"indicatif",
|
"indicatif",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "airlock_libs"
|
name = "airlock_libs"
|
||||||
version = "4.0.1"
|
version = "4.0.2"
|
||||||
edition = "2024"
|
edition = "2024"
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ build-backend = "maturin"
|
|||||||
|
|
||||||
[project]
|
[project]
|
||||||
name = "airlock_libs"
|
name = "airlock_libs"
|
||||||
version = "4.0.1"
|
version = "4.0.2"
|
||||||
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" }
|
||||||
|
|||||||
@@ -96,7 +96,13 @@ pub fn pull_policy_exec_histories(
|
|||||||
exec_types: String,
|
exec_types: String,
|
||||||
days: i64,
|
days: i64,
|
||||||
) -> Py<PyString> {
|
) -> Py<PyString> {
|
||||||
let rt = tokio::runtime::Runtime::new().unwrap();
|
let rt = match tokio::runtime::Runtime::new() {
|
||||||
|
Ok(rt) => rt,
|
||||||
|
Err(e) => {
|
||||||
|
println!("Failed to build Tokio Runtime: {:?}", e);
|
||||||
|
std::process::abort();
|
||||||
|
}
|
||||||
|
};
|
||||||
rt.block_on(async {
|
rt.block_on(async {
|
||||||
let _ = init_tracer();
|
let _ = init_tracer();
|
||||||
});
|
});
|
||||||
@@ -135,7 +141,13 @@ pub fn pull_policy_exec_histories(
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
let data_write = serde_json::to_string_pretty(&data).expect("Failed to serialize");
|
let data_write = serde_json::to_string_pretty(&data).expect("Failed to serialize");
|
||||||
fs::write(writeable_filepath.clone(), data_write).unwrap();
|
match fs::write(writeable_filepath.clone(), data_write) {
|
||||||
|
Ok(_) => {}
|
||||||
|
Err(e) => {
|
||||||
|
println!("Failed to write to: {:?}: {}", &writeable_filepath, e);
|
||||||
|
std::process::abort();
|
||||||
|
}
|
||||||
|
}
|
||||||
let mut checkpoint_number: String = skipback(days).to_string();
|
let mut checkpoint_number: String = skipback(days).to_string();
|
||||||
let multi_progress = MultiProgress::new();
|
let multi_progress = MultiProgress::new();
|
||||||
multi_progress.set_draw_target(ProgressDrawTarget::stdout());
|
multi_progress.set_draw_target(ProgressDrawTarget::stdout());
|
||||||
@@ -274,7 +286,12 @@ pub fn pull_policy_exec_histories(
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
let data_write = serde_json::to_string_pretty(&final_response).unwrap();
|
let data_write = serde_json::to_string_pretty(&final_response).unwrap();
|
||||||
fs::write(&writeable_filepath, data_write).unwrap();
|
match fs::write(&writeable_filepath, data_write) {
|
||||||
|
Ok(_) => {}
|
||||||
|
Err(e) => {
|
||||||
|
println!("Failed to write to: {:?}: {}", &writeable_filepath, e);
|
||||||
|
}
|
||||||
|
}
|
||||||
if let Some(last_item) = &final_response.response.exechistories.last()
|
if let Some(last_item) = &final_response.response.exechistories.last()
|
||||||
&& let Ok(last_date) = NaiveDate::parse_from_str(
|
&& let Ok(last_date) = NaiveDate::parse_from_str(
|
||||||
&last_item.datetime.replace(" +0000 UTC", ""),
|
&last_item.datetime.replace(" +0000 UTC", ""),
|
||||||
@@ -289,7 +306,13 @@ pub fn pull_policy_exec_histories(
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
progress_bar.finish_with_message("All Checkpoints Complete");
|
progress_bar.finish_with_message("All Checkpoints Complete");
|
||||||
let return_data = fs::read_to_string(&writeable_filepath).unwrap();
|
let return_data = match fs::read_to_string(&writeable_filepath) {
|
||||||
|
Ok(return_data) => return_data,
|
||||||
|
Err(e) => {
|
||||||
|
println!("Failed to read data from: {:?}: {}", &writeable_filepath, e);
|
||||||
|
std::process::abort();
|
||||||
|
}
|
||||||
|
};
|
||||||
shutdown_tracer_provider();
|
shutdown_tracer_provider();
|
||||||
PyString::new(py, &return_data).into()
|
PyString::new(py, &return_data).into()
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -11,4 +11,4 @@ urllib3==2.5.0
|
|||||||
pyperclip==1.11.0
|
pyperclip==1.11.0
|
||||||
|
|
||||||
--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==4.0.1
|
airlock_libs==4.0.2
|
||||||
Reference in New Issue
Block a user