From 2465cb60ddaf15b10eef929bb41bc82d06daf650 Mon Sep 17 00:00:00 2001 From: Evan Thomas Date: Mon, 4 Nov 2024 11:50:19 +0100 Subject: [PATCH] Remove debug messages --- src/external/k8s/services.rs | 4 ---- src/external/tus/hooks.rs | 20 ++------------------ src/submissions/views.rs | 11 ++--------- src/uploads/views.rs | 1 - 4 files changed, 4 insertions(+), 32 deletions(-) diff --git a/src/external/k8s/services.rs b/src/external/k8s/services.rs index 12fa032..6a7e728 100644 --- a/src/external/k8s/services.rs +++ b/src/external/k8s/services.rs @@ -56,7 +56,6 @@ fn extract_refresh_token(kubeconfig: &Kubeconfig) -> Option { } } } - println!("No refresh token found in kubeconfig."); None } @@ -90,7 +89,6 @@ pub async fn get_pods() -> Result, ku None => None, }; - // println!("\nPod status: {:#?}\n", pod); let phase = pod.status.as_ref().and_then(|status| status.phase.clone()); // Get the latest status time by the latest container status.conditions ordered by last_transition_time @@ -202,8 +200,6 @@ pub async fn get_jobs_for_submission_id(submission_id: Uuid) -> Result = pods .into_iter() diff --git a/src/external/tus/hooks.rs b/src/external/tus/hooks.rs index 7c027c0..874a75f 100644 --- a/src/external/tus/hooks.rs +++ b/src/external/tus/hooks.rs @@ -15,8 +15,6 @@ pub(super) async fn handle_pre_create( s3: Arc, payload: EventPayload, ) -> Result { - println!("Handling pre-create"); - let filename = payload.event.upload.metadata.filename; let filetype = payload.event.upload.metadata.filetype; let size_in_bytes = payload.event.upload.size; @@ -27,8 +25,6 @@ pub(super) async fn handle_pre_create( }, _ => Err(anyhow::anyhow!("Submission ID not found"))?, }; - println!("Submission ID: {}", submission_id); - println!("Filename: {}, Filetype: {}", filename, filetype); // Check that the submission does not already have that same filename let results: Vec<(SubmissionDB::Model, Vec)> = @@ -62,10 +58,7 @@ pub(super) async fn handle_pre_create( } else { // File upload is incomplete, delete from S3 and DB crate::uploads::services::delete_object(&db, &s3, existing_object.id).await?; - match existing_object.clone().delete(&db).await { - Ok(_) => println!("Deleted incomplete file from S3 and database"), - _ => return Err(anyhow::anyhow!("Failed to delete object")), - } + existing_object.clone().delete(&db).await?; } } } @@ -126,7 +119,6 @@ pub(super) async fn handle_post_create( db: DatabaseConnection, payload: EventPayload, ) -> Result { - println!("Handling post-create"); let upload_id = &payload.event.upload.id; // Split the upload_id on the + separator to get the object ID. let object_id: Uuid = match upload_id @@ -136,7 +128,6 @@ pub(super) async fn handle_post_create( { Some(id) => id, _ => { - println!("Invalid object ID in upload_id"); return Err(anyhow::anyhow!("Invalid object ID in upload_id")); } }; @@ -170,7 +161,6 @@ pub(super) async fn handle_post_receive( db: DatabaseConnection, payload: EventPayload, ) -> Result { - println!("Handling post-receive"); let upload_id = &payload.event.upload.id; // Split the upload_id on the + separator to get the object ID. let object_id: Uuid = match upload_id @@ -180,7 +170,6 @@ pub(super) async fn handle_post_receive( { Some(id) => id, _ => { - println!("Invalid object ID in upload_id"); return Err(anyhow::anyhow!("Invalid object ID in upload_id")); } }; @@ -228,7 +217,6 @@ pub(super) async fn handle_pre_finish( db: DatabaseConnection, payload: EventPayload, ) -> Result { - println!("Handling pre-finish"); let upload_id = &payload.event.upload.id; // Split the upload_id on the + separator to get the object ID. let object_id: Uuid = match upload_id @@ -238,7 +226,6 @@ pub(super) async fn handle_pre_finish( { Some(id) => id, _ => { - println!("Invalid object ID in upload_id"); return Err(anyhow::anyhow!("Invalid object ID in upload_id")); } }; @@ -272,7 +259,6 @@ pub(super) async fn handle_post_finish( db: DatabaseConnection, payload: EventPayload, ) -> Result { - println!("Handling post-finish"); let upload_id = &payload.event.upload.id; // Split the upload_id on the + separator to get the object ID. @@ -283,7 +269,6 @@ pub(super) async fn handle_post_finish( { Some(id) => id, _ => { - println!("Invalid object ID in upload_id"); return Err(anyhow::anyhow!("Invalid object ID in upload_id")); } }; @@ -318,7 +303,7 @@ pub(super) async fn handle_post_terminate( payload: EventPayload, ) -> Result { // This hook is sent when the file should be cleaned up (del from db) - println!("Handling post-terminate"); + let upload_id = &payload.event.upload.id; // Split the upload_id on the + separator to get the object ID. @@ -329,7 +314,6 @@ pub(super) async fn handle_post_terminate( { Some(id) => id, _ => { - println!("Invalid object ID in upload_id"); return Err(anyhow::anyhow!("Invalid object ID in upload_id")); } }; diff --git a/src/submissions/views.rs b/src/submissions/views.rs index d4ab331..889c666 100644 --- a/src/submissions/views.rs +++ b/src/submissions/views.rs @@ -356,19 +356,12 @@ pub async fn execute_workflow( }, ); - println!("Submitting TrainingWorkload: {:?}", training_workload); // Submit the custom resource to Kubernetes let api: Api = Api::namespaced(client, &config.kube_namespace); match api.create(&PostParams::default(), &training_workload).await { - Ok(_) => { - println!("Submitted TrainingWorkload: {}", job_name); - StatusCode::CREATED - } - Err(e) => { - eprintln!("Failed to submit TrainingWorkload: {:?}", e); - StatusCode::INTERNAL_SERVER_ERROR - } + Ok(_) => StatusCode::CREATED, + Err(_) => StatusCode::INTERNAL_SERVER_ERROR, } } diff --git a/src/uploads/views.rs b/src/uploads/views.rs index d4ae1e3..90b5564 100644 --- a/src/uploads/views.rs +++ b/src/uploads/views.rs @@ -125,7 +125,6 @@ pub async fn delete_one( Ok(_) => StatusCode::NO_CONTENT, Err(err) => { // Log the error if needed - eprintln!("Failed to delete object: {:?}", err); if err.to_string() == "Object not found" { StatusCode::NOT_FOUND } else {