Skip to content

Commit 4ffb142

Browse files
Slight refactor to agent progress receipt
1 parent 244d878 commit 4ffb142

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/experiments.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -500,7 +500,7 @@ impl Experiment {
500500
}
501501
}
502502

503-
pub fn handle_failure(&mut self, db: &Database, agent: &Assignee) -> Fallible<()> {
503+
pub fn clear_agent_progress(&mut self, db: &Database, agent: &str) -> Fallible<()> {
504504
// Mark all the running crates from this agent as queued (so that they
505505
// run again)
506506
db.execute(
@@ -514,7 +514,7 @@ impl Experiment {
514514
&Status::Queued.to_string(),
515515
&self.name,
516516
&Status::Running.to_string(),
517-
&agent.to_string(),
517+
&Assignee::Agent(agent.to_string()).to_string(),
518518
],
519519
)?;
520520
Ok(())
@@ -1096,7 +1096,7 @@ mod tests {
10961096
.get_uncompleted_crates(&db, &config, &agent1)
10971097
.unwrap()
10981098
.is_empty());
1099-
ex.handle_failure(&db, &agent1).unwrap();
1099+
ex.clear_agent_progress(&db, "agent-1").unwrap();
11001100
assert!(Experiment::next(&db, &agent1).unwrap().is_some());
11011101
assert_eq!(ex.status, Status::Running);
11021102
assert!(!ex

src/server/routes/agent.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ fn endpoint_error(
323323
.ok_or_else(|| err_msg("no experiment run by this agent"))?;
324324

325325
data.metrics.record_error(&auth.name, &ex.name);
326-
ex.handle_failure(&data.db, &Assignee::Agent(auth.name))?;
326+
ex.clear_agent_progress(&data.db, &auth.name)?;
327327

328328
Ok(ApiResponse::Success { result: true }.into_response()?)
329329
}

0 commit comments

Comments
 (0)