From 98d19a579cd36c35002d528c37f4424daa5a926b Mon Sep 17 00:00:00 2001 From: Nico Arqueros Date: Thu, 31 Oct 2024 19:07:15 -0500 Subject: [PATCH] remove logs --- .../v1_api/api_v1_internal_commands.rs | 5 -- .../network/v2_api/api_v2_commands_jobs.rs | 11 --- shinkai-libs/shinkai-db/src/db/db_inbox.rs | 7 -- shinkai-libs/shinkai-db/src/db/db_jobs.rs | 75 ------------------- 4 files changed, 98 deletions(-) diff --git a/shinkai-bin/shinkai-node/src/network/v1_api/api_v1_internal_commands.rs b/shinkai-bin/shinkai-node/src/network/v1_api/api_v1_internal_commands.rs index aec1de8a1..85b523379 100644 --- a/shinkai-bin/shinkai-node/src/network/v1_api/api_v1_internal_commands.rs +++ b/shinkai-bin/shinkai-node/src/network/v1_api/api_v1_internal_commands.rs @@ -126,8 +126,6 @@ impl Node { return Vec::new(); } }; - // Start the timer - let start = Instant::now(); let result = match db.get_inboxes_for_profile(standard_identity) { Ok(inboxes) => inboxes, Err(e) => { @@ -139,9 +137,6 @@ impl Node { return Vec::new(); } }; - // Measure the elapsed time - let duration = start.elapsed(); - println!("Time taken to get all inboxes: {:?}", duration); result } diff --git a/shinkai-bin/shinkai-node/src/network/v2_api/api_v2_commands_jobs.rs b/shinkai-bin/shinkai-node/src/network/v2_api/api_v2_commands_jobs.rs index ac18248e6..ecb805682 100644 --- a/shinkai-bin/shinkai-node/src/network/v2_api/api_v2_commands_jobs.rs +++ b/shinkai-bin/shinkai-node/src/network/v2_api/api_v2_commands_jobs.rs @@ -444,8 +444,6 @@ impl Node { } }; - // Start the timer - let start = Instant::now(); // Retrieve all smart inboxes for the profile let smart_inboxes = match db.get_all_smart_inboxes_for_profile(main_identity) { Ok(inboxes) => inboxes, @@ -460,21 +458,12 @@ impl Node { } }; - // Measure the elapsed time - let duration = start.elapsed(); - println!("Time taken to get all inboxes: {:?}", duration); - - let start = Instant::now(); // Convert SmartInbox to V2SmartInbox let v2_smart_inboxes: Result, NodeError> = smart_inboxes .into_iter() .map(Self::convert_smart_inbox_to_v2_smart_inbox) .collect(); - // Measure the elapsed time - let duration = start.elapsed(); - println!("Time taken to convert smart inboxes: {:?}", duration); - match v2_smart_inboxes { Ok(inboxes) => { let _ = res.send(Ok(inboxes)).await; diff --git a/shinkai-libs/shinkai-db/src/db/db_inbox.rs b/shinkai-libs/shinkai-db/src/db/db_inbox.rs index 873b35a07..7f58bc527 100644 --- a/shinkai-libs/shinkai-db/src/db/db_inbox.rs +++ b/shinkai-libs/shinkai-db/src/db/db_inbox.rs @@ -503,10 +503,6 @@ impl ShinkaiDB { .next() .and_then(|mut v| v.pop()); - // Measure the elapsed time - let duration = start.elapsed(); - println!("Time taken to get last message: {:?}", duration); - let cf_inbox = self.get_cf_handle(Topic::Inbox).unwrap(); let inbox_smart_inbox_name_key = format!("{}_smart_inbox_name", &inbox_id); let custom_name = match self.db.get_cf(cf_inbox, inbox_smart_inbox_name_key.as_bytes())? { @@ -536,9 +532,6 @@ impl ShinkaiDB { false }; - // Start the timer - let start = Instant::now(); - let agent_subset = { let profile_result = profile_name_identity.full_identity_name.clone().extract_profile(); match profile_result { diff --git a/shinkai-libs/shinkai-db/src/db/db_jobs.rs b/shinkai-libs/shinkai-db/src/db/db_jobs.rs index 8fc24dc6e..ec551708d 100644 --- a/shinkai-libs/shinkai-db/src/db/db_jobs.rs +++ b/shinkai-libs/shinkai-db/src/db/db_jobs.rs @@ -329,9 +329,6 @@ impl ShinkaiDB { let cf_jobs = self.get_cf_handle(Topic::Inbox).unwrap(); // Begin fetching the data from the DB - // Start the timer - let start = Instant::now(); - let scope_value = self .db .get_cf(cf_jobs, format!("jobinbox_{}_scope", job_id).as_bytes())? @@ -344,8 +341,6 @@ impl ShinkaiDB { Ok::(MinimalJobScope::from(&job_scope)) })?; - eprintln!("Scope: {:?}", scope); - let mut scope_with_files: Option = None; if fetch_scope_with_files { let scope_with_files_value = if let Some(value) = self @@ -363,23 +358,12 @@ impl ShinkaiDB { scope_with_files = Some(JobScope::from_bytes(&scope_with_files_value)?); } - // Measure the elapsed time - let duration = start.elapsed(); - println!("Time taken to get scope: {:?}", duration); - - // Start the timer - let start = Instant::now(); - let is_finished_value = self .db .get_cf(cf_jobs, format!("jobinbox_{}_is_finished", job_id).as_bytes())? .ok_or(ShinkaiDBError::DataNotFound)?; let is_finished = std::str::from_utf8(&is_finished_value)? == "true"; - // Measure the elapsed time - let duration = start.elapsed(); - println!("Time taken to get is_finished: {:?}", duration); - // Start the timer let start = Instant::now(); @@ -389,26 +373,12 @@ impl ShinkaiDB { .ok_or(ShinkaiDBError::DataNotFound)?; let datetime_created = std::str::from_utf8(&datetime_created_value)?.to_string(); - // Measure the elapsed time - let duration = start.elapsed(); - println!("Time taken to get datetime_created: {:?}", duration); - - // Start the timer - let start = Instant::now(); - let parent_agent_id_value = self .db .get_cf(cf_jobs, format!("jobinbox_{}_agentid", job_id).as_bytes())? .ok_or(ShinkaiDBError::DataNotFound)?; let parent_agent_id = std::str::from_utf8(&parent_agent_id_value)?.to_string(); - // Measure the elapsed time - let duration = start.elapsed(); - println!("Time taken to get parent_agent_id: {:?}", duration); - - // Start the timer - let start = Instant::now(); - let job_inbox_name = self .db .get_cf(cf_jobs, format!("jobinbox_{}_inboxname", job_id).as_bytes())? @@ -416,36 +386,15 @@ impl ShinkaiDB { let inbox_name = std::str::from_utf8(&job_inbox_name)?.to_string(); let conversation_inbox = InboxName::new(inbox_name)?; - // Measure the elapsed time - let duration = start.elapsed(); - println!("Time taken to get conversation_inbox: {:?}", duration); - - // Start the timer - let start = Instant::now(); - let is_hidden_value = self .db .get_cf(cf_jobs, format!("jobinbox_{}_is_hidden", job_id).as_bytes())? .unwrap_or_else(|| b"false".to_vec()); let is_hidden = std::str::from_utf8(&is_hidden_value)? == "true"; - // Measure the elapsed time - let duration = start.elapsed(); - println!("Time taken to get is_hidden: {:?}", duration); - - // Start the timer - let start = Instant::now(); - // Reads all of the step history by iterating let step_history = self.get_step_history(job_id, fetch_step_history)?; - // Measure the elapsed time - let duration = start.elapsed(); - println!("Time taken to get step_history: {:?}", duration); - - // Start the timer - let start = Instant::now(); - // Try to read associated_ui let associated_ui_value = self .db @@ -454,13 +403,6 @@ impl ShinkaiDB { .flatten() .and_then(|value| serde_json::from_slice(&value).ok()); - // Measure the elapsed time - let duration = start.elapsed(); - println!("Time taken to get associated_ui: {:?}", duration); - - // Start the timer - let start = Instant::now(); - let config_value = self .db .get_cf(cf_jobs, format!("jobinbox_{}_config", job_id).as_bytes()) @@ -468,19 +410,8 @@ impl ShinkaiDB { .flatten() .and_then(|value| serde_json::from_slice(&value).ok()); - // Measure the elapsed time - let duration = start.elapsed(); - println!("Time taken to get config: {:?}", duration); - - // Start the timer - let start = Instant::now(); - let forked_jobs = self.get_forked_jobs(job_id)?; - // Measure the elapsed time - let duration = start.elapsed(); - println!("Time taken to get forked_jobs: {:?}", duration); - Ok(( scope, scope_with_files, @@ -928,9 +859,6 @@ impl ShinkaiDB { /// Fetches all forked jobs for a specific Job from the DB fn get_forked_jobs(&self, job_id: &str) -> Result, ShinkaiDBError> { - // Start the timer - let start = Instant::now(); - let cf_inbox = self.get_cf_handle(Topic::Inbox).unwrap(); // TODO: this is wrong let forked_jobs_key = format!("jobinbox_{}_forked_jobs", job_id); @@ -938,9 +866,6 @@ impl ShinkaiDB { match self.db.get_cf(cf_inbox, forked_jobs_key.as_bytes()) { Ok(Some(value)) => { let forked_jobs: Vec = serde_json::from_slice(&value)?; - // Measure the elapsed time - let duration = start.elapsed(); - println!("Time taken to get forked jobs: {:?}", duration); Ok(forked_jobs) } Ok(None) => Ok(Vec::new()),