Simplify example

This commit is contained in:
Patrick Lühne 2019-03-02 02:26:16 +01:00
parent cf9c899dab
commit 3212daac54
Signed by: patrick
GPG Key ID: 05F3611E97A70ABF
2 changed files with 16 additions and 54 deletions

View File

@ -14,65 +14,28 @@ fn main()
{ {
pretty_env_logger::init(); pretty_env_logger::init();
let mut benchmark_repository = BenchmarkRepository::new("gitea@git.luehne.de:patrick/tplp-planning-benchmark.git", Path::new("cache").to_path_buf(), "gitea"); let mut benchmark_repository = BenchmarkRepository::new("gitea@git.luehne.de:patrick/benchmark-template.git", Path::new("cache").to_path_buf(), "gitea");
let content = benchmark_repository.read_file(Path::new("configurations.yml"), "config").unwrap();
let configurations = &YamlLoader::load_from_str(&content).unwrap()[0]["configurations"];
let content = benchmark_repository.read_file(Path::new("instances.yml"), "config").unwrap(); let content = benchmark_repository.read_file(Path::new("instances.yml"), "config").unwrap();
let instances = &YamlLoader::load_from_str(&content).unwrap()[0]; let instances = &YamlLoader::load_from_str(&content).unwrap()[0];
let mut i = 0; for instance in instances.as_vec().unwrap()
for configuration in configurations.as_vec().unwrap()
{ {
for (instance_set_id, instance_set) in instances.as_hash().unwrap() let fruit = instance["fruit"].as_str().unwrap();
{ let time = instance["time"].as_i64().unwrap();
for instance in instance_set.as_vec().unwrap()
{
let configuration_id = configuration["id"].as_str().unwrap();
let instance_set_id = instance_set_id.as_str().unwrap();
let instance_ipc = instance["ipc"].as_str().unwrap();
let instance_domain = instance["domain"].as_str().unwrap();
let instance_number = instance["instance"].as_i64().unwrap();
let job_key = format!("{}/{}/{}/{}", configuration_id, instance_ipc, instance_domain, instance_number); let job_key = format!("{}/{}", fruit, time);
let file_name_output = format!("{}.out", job_key); let job = benchmark_repository.create_job(job_key);
if benchmark_repository.file_exists(Path::new(&file_name_output), "results") Command::new("sbatch")
{ .args(&["/home/pluehne/test-job.sh", "--nodes", "1", "--ntasks-per-node", "1", "-p", "kr"])
println!("done: [{}, {}, {}/{}/{}]", configuration_id, instance_set_id, instance_ipc, instance_domain, instance_number); .env("JOB_RESULT_REPOSITORY_URL", &format!("file://{}", fs::canonicalize(&job.result_repository_path).unwrap().display()))
continue; .env("JOB_ID", format!("{}", job.id))
} .env("JOB_KEY", &job.key)
.env("FRUIT", fruit)
let job = benchmark_repository.create_job(job_key); .env("TIME", format!("{}", time))
.output()
Command::new("sbatch") .expect("Could not execute command");
.args(&["/home/pluehne/test-job.sh", "--nodes", "1", "--ntasks-per-node", "1", "-p", "kr"])
.env("JOB_RESULT_REPOSITORY_URL", &format!("file://{}", fs::canonicalize(&job.result_repository_path).unwrap().display()))
.env("JOB_ID", format!("{}", job.id))
.env("JOB_KEY", format!("{}", job.key))
.output()
.expect("Could not execute command");
i += 1;
if i > 10
{
break;
}
}
if i > 10
{
break;
}
}
if i > 10
{
break;
}
} }
benchmark_repository.join(); benchmark_repository.join();

View File

@ -150,8 +150,7 @@ impl BenchmarkRepository
benchmark_repository benchmark_repository
.reset_origin(remote_url) .reset_origin(remote_url)
.fetch_branch("config") .fetch_branch("config")
.fetch_branch("results") .fetch_branch("results");
.fetch_branch("status");
benchmark_repository benchmark_repository
} }