Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support multiple evaluators on a single machine #673

Merged
merged 3 commits into from
Feb 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion ofborg/src/bin/mass-rebuilder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ fn main() -> Result<(), Box<dyn Error>> {
let conn = easylapin::from_config(&cfg.rabbitmq)?;
let mut chan = task::block_on(conn.create_channel())?;

let cloner = checkout::cached_cloner(Path::new(&cfg.checkout.root));
let root = Path::new(&cfg.checkout.root);
let cloner = checkout::cached_cloner(&root.join(cfg.runner.instance.to_string()));
let nix = cfg.nix();

let events = stats::RabbitMq::from_lapin(&cfg.whoami(), task::block_on(conn.create_channel())?);
Expand Down
7 changes: 7 additions & 0 deletions ofborg/src/clone.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,13 @@ pub trait GitClonable {
.stdout(Stdio::null())
.status()?;

debug!("git gc");
Command::new("git")
.arg("gc")
.current_dir(self.clone_to())
.stdout(Stdio::null())
.status()?;

lock.unlock();

Ok(())
Expand Down
6 changes: 6 additions & 0 deletions ofborg/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,14 @@ pub struct LogStorage {
pub path: String,
}

const fn default_instance() -> u8 {
1
}

#[derive(Serialize, Deserialize, Debug)]
pub struct RunnerConfig {
#[serde(default = "default_instance")]
pub instance: u8,
pub identity: String,
pub repos: Option<Vec<String>>,
#[serde(default = "Default::default")]
Expand Down
11 changes: 10 additions & 1 deletion ofborg/src/tasks/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,10 @@ impl<'a, 'b> JobActions<'a, 'b> {
self.snippet_log.clone().into()
}

pub fn pr_head_missing(&mut self) {
self.tell(worker::Action::Ack);
}

pub fn commit_missing(&mut self) {
self.tell(worker::Action::Ack);
}
Expand Down Expand Up @@ -311,7 +315,12 @@ impl notifyworker::SimpleNotifyWorker for BuildWorker {
};

let refpath = co.checkout_origin_ref(target_branch.as_ref()).unwrap();
co.fetch_pr(job.pr.number).unwrap();

if co.fetch_pr(job.pr.number).is_err() {
info!("Failed to fetch {}", job.pr.number);
actions.pr_head_missing();
return;
}

if !co.commit_exists(job.pr.head_sha.as_ref()) {
info!("Commit {} doesn't exist", job.pr.head_sha);
Expand Down
Loading