log how much time took each command child

This commit is contained in:
Ruben Fiszel
2023-04-18 08:55:26 +02:00
parent e87605d1f5
commit 6954d0882e
3 changed files with 44 additions and 10 deletions
+24 -4
View File
@@ -111,9 +111,18 @@ pub async fn pip_compile(
.stdout(Stdio::piped())
.stderr(Stdio::piped())
.spawn()?;
handle_child(job_id, db, logs, child, false, worker_name, &w_id)
.await
.map_err(|e| Error::ExecutionErr(format!("Lock file generation failed: {e:?}")))?;
handle_child(
job_id,
db,
logs,
child,
false,
worker_name,
&w_id,
"pip-compile",
)
.await
.map_err(|e| Error::ExecutionErr(format!("Lock file generation failed: {e:?}")))?;
let path_lock = format!("{job_dir}/requirements.txt");
let mut file = File::open(path_lock).await?;
let mut req_content = "".to_string();
@@ -420,6 +429,7 @@ mount {{
!*DISABLE_NSJAIL,
worker_name,
&job.workspace_id,
"python run",
)
.await?;
read_result(job_dir).await
@@ -518,7 +528,17 @@ pub async fn handle_python_reqs(
.spawn()?
};
let child = handle_child(&job_id, db, logs, child, false, worker_name, &w_id).await;
let child = handle_child(
&job_id,
db,
logs,
child,
false,
worker_name,
&w_id,
&format!("pip install {req}"),
)
.await;
tracing::info!(
worker_name = %worker_name,
job_id = %job_id,