mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-08-19 16:02:14 +00:00
improve debug logs
This commit is contained in:
@@ -80,14 +80,14 @@ impl UserDB {
|
||||
let mut folders_read = folders_read.clone();
|
||||
folders_read.extend(folders_write.clone());
|
||||
|
||||
tracing::debug!(
|
||||
"Setting role to {} {:?} {:?} {:?} {:?}",
|
||||
user,
|
||||
authed.username(),
|
||||
authed.groups(),
|
||||
folders_read,
|
||||
folders_write
|
||||
);
|
||||
// tracing::debug!(
|
||||
// "Setting role to {} {:?} {:?} {:?} {:?}",
|
||||
// user,
|
||||
// authed.username(),
|
||||
// authed.groups(),
|
||||
// folders_read,
|
||||
// folders_write
|
||||
// );
|
||||
|
||||
let mut tx = self.db.begin().await?;
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ use std::{
|
||||
collections::HashMap,
|
||||
sync::{Arc, RwLock},
|
||||
};
|
||||
use tracing::Event;
|
||||
use tracing::{level_filters::LevelFilter, Event};
|
||||
use tracing_appender::non_blocking::{NonBlockingBuilder, WorkerGuard};
|
||||
use tracing_subscriber::layer::Context;
|
||||
use tracing_subscriber::{
|
||||
@@ -51,12 +51,21 @@ pub fn initialize_tracing(
|
||||
) -> (WorkerGuard, crate::otel_ee::OtelProvider) {
|
||||
let style = std::env::var("RUST_LOG_STYLE").unwrap_or_else(|_| "auto".into());
|
||||
|
||||
if std::env::var("RUST_LOG").is_ok_and(|x| x == "debug" || x == "info") {
|
||||
let rust_log_env = std::env::var("RUST_LOG");
|
||||
if rust_log_env
|
||||
.as_ref()
|
||||
.is_ok_and(|x| x == "debug" || x == "info")
|
||||
{
|
||||
std::env::set_var(
|
||||
"RUST_LOG",
|
||||
&format!("windmill={}", std::env::var("RUST_LOG").unwrap()),
|
||||
&format!("windmill={}", rust_log_env.as_ref().unwrap()),
|
||||
)
|
||||
}
|
||||
let default_env_filter = if rust_log_env.is_ok_and(|x| x == "debug") {
|
||||
LevelFilter::DEBUG
|
||||
} else {
|
||||
LevelFilter::INFO
|
||||
};
|
||||
|
||||
let meter_provider = crate::otel_ee::init_meter_provider(mode, hostname, environment);
|
||||
|
||||
@@ -109,7 +118,7 @@ pub fn initialize_tracing(
|
||||
"windmill:job_log",
|
||||
tracing::level_filters::LevelFilter::OFF,
|
||||
)
|
||||
.with_default(tracing::level_filters::LevelFilter::INFO),
|
||||
.with_default(default_env_filter),
|
||||
),
|
||||
)
|
||||
.with(CountingLayer::new())
|
||||
@@ -131,7 +140,7 @@ pub fn initialize_tracing(
|
||||
"windmill:job_log",
|
||||
tracing::level_filters::LevelFilter::OFF,
|
||||
)
|
||||
.with_default(tracing::level_filters::LevelFilter::INFO),
|
||||
.with_default(default_env_filter),
|
||||
),
|
||||
)
|
||||
.with(CountingLayer::new())
|
||||
|
||||
@@ -429,7 +429,7 @@ async fn postinstall(
|
||||
}
|
||||
|
||||
if let Some(existing_paths) = lookup_table.get_mut(&name) {
|
||||
tracing::info!(
|
||||
tracing::debug!(
|
||||
"Found existing package name: {:?} in {}",
|
||||
entry.file_name(),
|
||||
path
|
||||
@@ -480,6 +480,8 @@ fn copy_dir_recursively(src: &Path, dst: &Path) -> windmill_common::error::Resul
|
||||
fs::create_dir_all(dst)?;
|
||||
}
|
||||
|
||||
tracing::debug!("Copying recursively from {:?} to {:?}", src, dst);
|
||||
|
||||
for entry in fs::read_dir(src)? {
|
||||
let entry = entry?;
|
||||
let src_path = entry.path();
|
||||
@@ -492,6 +494,8 @@ fn copy_dir_recursively(src: &Path, dst: &Path) -> windmill_common::error::Resul
|
||||
}
|
||||
}
|
||||
|
||||
tracing::debug!("Finished copying recursively from {:?} to {:?}", src, dst);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -530,10 +534,13 @@ pub async fn handle_python_job(
|
||||
)
|
||||
.await?;
|
||||
|
||||
tracing::debug!("Finished handling python dependencies");
|
||||
|
||||
if !PythonAnnotations::parse(inner_content).no_postinstall {
|
||||
if let Err(e) = postinstall(&mut additional_python_paths, job_dir, job, db).await {
|
||||
tracing::error!("Postinstall stage has failed. Reason: {e}");
|
||||
}
|
||||
tracing::debug!("Finished deps postinstall stage");
|
||||
}
|
||||
|
||||
append_logs(
|
||||
@@ -564,9 +571,13 @@ pub async fn handle_python_job(
|
||||
)
|
||||
.await?;
|
||||
|
||||
tracing::debug!("Finished preparing wrapper");
|
||||
|
||||
let apply_preprocessor = pre_spread.is_some();
|
||||
|
||||
create_args_and_out_file(&client, job, job_dir, db).await?;
|
||||
tracing::debug!("Finished preparing wrapper");
|
||||
|
||||
|
||||
let preprocessor = if let Some(pre_spread) = pre_spread {
|
||||
format!(
|
||||
@@ -665,6 +676,8 @@ except BaseException as e:
|
||||
);
|
||||
write_file(job_dir, "wrapper.py", &wrapper_content)?;
|
||||
|
||||
tracing::debug!("Finished writing wrapper");
|
||||
|
||||
let client = client.get_authed().await;
|
||||
let mut reserved_variables = get_reserved_variables(job, &client.token, db).await?;
|
||||
let additional_python_paths_folders = additional_python_paths.iter().join(":");
|
||||
|
||||
Reference in New Issue
Block a user