Skip to content

Instantly share code, notes, and snippets.

@yohm
Created November 9, 2015 08:26
Show Gist options
  • Save yohm/5daa2cfae26aaa9f1262 to your computer and use it in GitHub Desktop.
Save yohm/5daa2cfae26aaa9f1262 to your computer and use it in GitHub Desktop.
OACISでParameterSetQueryを指定して、配下のRunを一括replaceするスクリプト。
require './config/environment'
psq_id = ARGV[0]
psq = ParameterSetQuery.find(psq_id)
$stderr.puts "Number of found PS: #{psq.parameter_sets.count}"
def replace_runs(run)
run_attr = { submitted_to: run.submitted_to,
mpi_procs: run.mpi_procs,
omp_threads: run.omp_threads,
host_parameters: run.host_parameters }
new_run = run.parameter_set.runs.build(run_attr)
if new_run.save
run.destroy
end
end
psq.parameter_sets.each do |ps|
$stderr.puts "replacing PS: #{ps.id}"
ps.runs.each do |run|
$stderr.puts " replacing Run: #{run.id}"
replace_runs(run)
end
end
@yohm
Copy link
Author

yohm commented Nov 9, 2015

使用法

bundle exec ruby replace_by_ps.rb <ParameterSetQueryID>

をOACISのリポジトリのディレクトリで実行する

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment