Skip to content

Commit

Permalink
Remove debug messages
Browse files Browse the repository at this point in the history
  • Loading branch information
evanjt committed Nov 4, 2024
1 parent 876b6c8 commit 2465cb6
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 32 deletions.
4 changes: 0 additions & 4 deletions src/external/k8s/services.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ fn extract_refresh_token(kubeconfig: &Kubeconfig) -> Option<String> {
}
}
}
println!("No refresh token found in kubeconfig.");
None
}

Expand Down Expand Up @@ -90,7 +89,6 @@ pub async fn get_pods() -> Result<Vec<crate::external::k8s::models::PodName>, 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
Expand Down Expand Up @@ -202,8 +200,6 @@ pub async fn get_jobs_for_submission_id(submission_id: Uuid) -> Result<Vec<PodNa
// Get app config and kube client
let pods = get_pods().await.unwrap();

println!("Found {} pods for {}", pods.len(), submission_id);

// Filter pods by submission_id
let jobs: Vec<PodName> = pods
.into_iter()
Expand Down
20 changes: 2 additions & 18 deletions src/external/tus/hooks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ pub(super) async fn handle_pre_create(
s3: Arc<S3Client>,
payload: EventPayload,
) -> Result<PreCreateResponse> {
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;
Expand All @@ -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<InputObjectDB::Model>)> =
Expand Down Expand Up @@ -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?;
}
}
}
Expand Down Expand Up @@ -126,7 +119,6 @@ pub(super) async fn handle_post_create(
db: DatabaseConnection,
payload: EventPayload,
) -> Result<PreCreateResponse> {
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
Expand All @@ -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"));
}
};
Expand Down Expand Up @@ -170,7 +161,6 @@ pub(super) async fn handle_post_receive(
db: DatabaseConnection,
payload: EventPayload,
) -> Result<PreCreateResponse> {
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
Expand All @@ -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"));
}
};
Expand Down Expand Up @@ -228,7 +217,6 @@ pub(super) async fn handle_pre_finish(
db: DatabaseConnection,
payload: EventPayload,
) -> Result<PreCreateResponse> {
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
Expand All @@ -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"));
}
};
Expand Down Expand Up @@ -272,7 +259,6 @@ pub(super) async fn handle_post_finish(
db: DatabaseConnection,
payload: EventPayload,
) -> Result<PreCreateResponse> {
println!("Handling post-finish");
let upload_id = &payload.event.upload.id;

// Split the upload_id on the + separator to get the object ID.
Expand All @@ -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"));
}
};
Expand Down Expand Up @@ -318,7 +303,7 @@ pub(super) async fn handle_post_terminate(
payload: EventPayload,
) -> Result<PreCreateResponse> {
// 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.
Expand All @@ -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"));
}
};
Expand Down
11 changes: 2 additions & 9 deletions src/submissions/views.rs
Original file line number Diff line number Diff line change
Expand Up @@ -356,19 +356,12 @@ pub async fn execute_workflow(
},
);

println!("Submitting TrainingWorkload: {:?}", training_workload);
// Submit the custom resource to Kubernetes
let api: Api<TrainingWorkload> = 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,
}
}

Expand Down
1 change: 0 additions & 1 deletion src/uploads/views.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 2465cb6

Please sign in to comment.