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();
let mut benchmark_repository = BenchmarkRepository::new("gitea@git.luehne.de:patrick/tplp-planning-benchmark.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 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("instances.yml"), "config").unwrap();
let instances = &YamlLoader::load_from_str(&content).unwrap()[0];
let mut i = 0;
for configuration in configurations.as_vec().unwrap()
for instance in instances.as_vec().unwrap()
{
for (instance_set_id, instance_set) in instances.as_hash().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 fruit = instance["fruit"].as_str().unwrap();
let time = instance["time"].as_i64().unwrap();
let job_key = format!("{}/{}/{}/{}", configuration_id, instance_ipc, instance_domain, instance_number);
let file_name_output = format!("{}.out", job_key);
let job_key = format!("{}/{}", fruit, time);
let job = benchmark_repository.create_job(job_key);
if benchmark_repository.file_exists(Path::new(&file_name_output), "results")
{
println!("done: [{}, {}, {}/{}/{}]", configuration_id, instance_set_id, instance_ipc, instance_domain, instance_number);
continue;
}
let job = benchmark_repository.create_job(job_key);
Command::new("sbatch")
.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;
}
Command::new("sbatch")
.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", &job.key)
.env("FRUIT", fruit)
.env("TIME", format!("{}", time))
.output()
.expect("Could not execute command");
}
benchmark_repository.join();

View File

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