mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-08-21 08:02:26 +00:00
nits logging
This commit is contained in:
+23
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"db_name": "PostgreSQL",
|
||||
"query": "SELECT CONCAT(coalesce(queue.logs, ''), coalesce(job_logs.logs, '')) \n FROM queue \n LEFT JOIN job_logs ON job_logs.job_id = queue.id \n WHERE queue.id = $1 AND queue.workspace_id = $2",
|
||||
"describe": {
|
||||
"columns": [
|
||||
{
|
||||
"ordinal": 0,
|
||||
"name": "concat",
|
||||
"type_info": "Text"
|
||||
}
|
||||
],
|
||||
"parameters": {
|
||||
"Left": [
|
||||
"Uuid",
|
||||
"Text"
|
||||
]
|
||||
},
|
||||
"nullable": [
|
||||
null
|
||||
]
|
||||
},
|
||||
"hash": "efc22aae27c30894f3d8ad9484f48439711707dba1f3112b495b1b18cbd31b31"
|
||||
}
|
||||
@@ -598,8 +598,22 @@ async fn get_job_logs(
|
||||
.fetch_optional(&db)
|
||||
.await?
|
||||
.flatten();
|
||||
let text = not_found_if_none(text, "Job Logs", id.to_string())?;
|
||||
Ok(text)
|
||||
if let Some(text) = text {
|
||||
Ok(text)
|
||||
} else {
|
||||
let text = sqlx::query_scalar!(
|
||||
"SELECT CONCAT(coalesce(queue.logs, ''), coalesce(job_logs.logs, ''))
|
||||
FROM queue
|
||||
LEFT JOIN job_logs ON job_logs.job_id = queue.id
|
||||
WHERE queue.id = $1 AND queue.workspace_id = $2",
|
||||
id,
|
||||
w_id
|
||||
)
|
||||
.fetch_one(&db)
|
||||
.await?;
|
||||
let text = not_found_if_none(text, "Job Logs", id.to_string())?;
|
||||
Ok(text)
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, sqlx::FromRow, Serialize)]
|
||||
|
||||
@@ -2716,6 +2716,15 @@ async fn handle_queued_job<R: rsmq_async::RsmqConnection + Send + Sync + Clone>(
|
||||
#[cfg(feature = "prometheus")]
|
||||
timer.map(|x| x.stop_and_record());
|
||||
} else {
|
||||
if job.logs.as_ref().is_some_and(|x| !x.is_empty()) {
|
||||
append_logs(
|
||||
job.id,
|
||||
job.workspace_id.clone(),
|
||||
job.logs.clone().unwrap(),
|
||||
db,
|
||||
)
|
||||
.await;
|
||||
}
|
||||
let mut logs = "".to_string();
|
||||
let mut mem_peak: i32 = 0;
|
||||
let mut canceled_by: Option<CanceledBy> = None;
|
||||
|
||||
Reference in New Issue
Block a user