Skip to content

Commit

Permalink
remove logs
Browse files Browse the repository at this point in the history
  • Loading branch information
nicarq committed Nov 1, 2024
1 parent abca248 commit 98d19a5
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 98 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand All @@ -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
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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<Vec<V2SmartInbox>, 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;
Expand Down
7 changes: 0 additions & 7 deletions shinkai-libs/shinkai-db/src/db/db_inbox.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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())? {
Expand Down Expand Up @@ -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 {
Expand Down
75 changes: 0 additions & 75 deletions shinkai-libs/shinkai-db/src/db/db_jobs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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())?
Expand All @@ -344,8 +341,6 @@ impl ShinkaiDB {
Ok::<MinimalJobScope, serde_json::Error>(MinimalJobScope::from(&job_scope))
})?;

eprintln!("Scope: {:?}", scope);

let mut scope_with_files: Option<JobScope> = None;
if fetch_scope_with_files {
let scope_with_files_value = if let Some(value) = self
Expand All @@ -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();

Expand All @@ -389,63 +373,28 @@ 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())?
.ok_or(ShinkaiDBError::DataNotFound)?;
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
Expand All @@ -454,33 +403,15 @@ 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())
.ok()
.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,
Expand Down Expand Up @@ -928,19 +859,13 @@ impl ShinkaiDB {

/// Fetches all forked jobs for a specific Job from the DB
fn get_forked_jobs(&self, job_id: &str) -> Result<Vec<ForkedJob>, 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);

match self.db.get_cf(cf_inbox, forked_jobs_key.as_bytes()) {
Ok(Some(value)) => {
let forked_jobs: Vec<ForkedJob> = 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()),
Expand Down

0 comments on commit 98d19a5

Please sign in to comment.