coderunner 0.17.10 → 0.17.11

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f0e504a2e59de06cb0a2803fdd41d48c2a59bd3e
4
- data.tar.gz: e64ebfe6d3a4133ee367a12f07e69c668804b7d0
3
+ metadata.gz: b46beec4f2b3baa9e4bf6933b06a0f7cb8907504
4
+ data.tar.gz: 1450dbcc231b6ff03b6a484c0defacbccb016845
5
5
  SHA512:
6
- metadata.gz: bcd46fc24d685d4a8054bcddc319bc7cd461659f2f4c7f25be8a6abcef88204e333d0937d78d92aa275674b7c6c8fb75cb5bf3befdee485685abecf5e9b18ca7
7
- data.tar.gz: b4ce04ca83e0c64bea321044f4a801be2645f099e534f444fbf92d302ae99b6f27cd12e05fa011585f59cd3d0bfaaef61ade57ca141d27e3915830f1acd2ef8a
6
+ metadata.gz: b6908d3436c7545bad131dc1e5063403a841dca0a5a384094cc5af6871a6dffd5821fd85079cf36926f1023f0b14d687b1c80bdea2f7b58f89615329c36b5a9e
7
+ data.tar.gz: 5f4b357155f3844f46eb46c2c99a9b107ef7149cbb07869a4072880a6a634f39a9b554e22d409d0f06c179e301bff6aec7e7e9e8183e5fa4daa4e45a606f1b33
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.17.10
1
+ 0.17.11
data/coderunner.gemspec CHANGED
@@ -2,17 +2,17 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: coderunner 0.17.10 ruby lib
5
+ # stub: coderunner 0.17.11 ruby lib
6
6
  # stub: ext/extconf.rb
7
7
 
8
8
  Gem::Specification.new do |s|
9
9
  s.name = "coderunner"
10
- s.version = "0.17.10"
10
+ s.version = "0.17.11"
11
11
 
12
12
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
13
13
  s.require_paths = ["lib"]
14
14
  s.authors = ["Edmund Highcock"]
15
- s.date = "2016-01-21"
15
+ s.date = "2016-04-01"
16
16
  s.description = "CodeRunner is a framework for the automated running and analysis of simulations. It automatically generates any necessary input files, organises the output data and analyses it. Because it is a modular system, it can easily be customised to work with any system and any simulation code. One of its greatest strengths is that it is independent of any one simulation code; thus it can easily plot and compare the data from different codes."
17
17
  s.email = "edmundhighcock@sourceforge.net"
18
18
  s.executables = ["coderunner", "coderunnerrepo"]
@@ -100,7 +100,7 @@ Gem::Specification.new do |s|
100
100
  s.licenses = ["GPLv3"]
101
101
  s.required_ruby_version = Gem::Requirement.new(">= 1.9.1")
102
102
  s.rubyforge_project = "coderunner"
103
- s.rubygems_version = "2.4.8"
103
+ s.rubygems_version = "2.2.0"
104
104
  s.summary = "A framework for the automated running and analysis of simulations."
105
105
 
106
106
  if s.respond_to? :specification_version then
@@ -9,8 +9,8 @@
9
9
  #define RFCALL_10_ON(obj, name) (rb_funcall(obj, rb_intern(name), 0))
10
10
  #define RFCALL_11(name, arg1) (rb_funcall(self, rb_intern(name), 1, arg1))
11
11
  #define RFCALL_11_ON(obj, name, arg1) (rb_funcall(obj, rb_intern(name), 1, arg1))
12
- #define RFCALL_12(name, arg1, arg2) (rb_funcall(self, rb_intern(name), 1, arg1, arg2))
13
- #define RFCALL_12_ON(obj, name, arg1, arg2) (rb_funcall(obj, rb_intern(name), 1, arg1, arg2))
12
+ #define RFCALL_12(name, arg1, arg2) (rb_funcall(self, rb_intern(name), 2, arg1, arg2))
13
+ #define RFCALL_12_ON(obj, name, arg1, arg2) (rb_funcall(obj, rb_intern(name), 2, arg1, arg2))
14
14
 
15
15
  /* Access an element of an array or hash*/
16
16
  #define CR_ELEMENT_ACCESS(recvr, key) ( \
@@ -129,24 +129,26 @@ class CodeRunner
129
129
 
130
130
  concat_string += runner.root_folder + '/' + name
131
131
 
132
- exec "#{concat_string}"
132
+ system "#{concat_string}"
133
133
  end
134
134
 
135
- # This section defines the report report writing function in. The latex header is defined in run.rb. It is a run method and can be redefined in a particular CRMOD.
136
- # The function is simply called as follows:
135
+ # This section defines the report report writing function in. The latex
136
+ # header is defined in run.rb. It is a run method and can be redefined in a
137
+ # particular CRMOD. The function is simply called as follows:
137
138
  #
138
- # interactively: wr j:<run no.>
139
- # command line: coderunner write_report -j <run no>
139
+ # interactively: wr j:<run no.> command line: coderunner write_report -j
140
+ # <run no>
140
141
  #
141
142
  # The requirements to use this function are:
142
143
  #
143
- # 1. pdflatex version 2014 or higher
144
- # 2. gnuplot
145
- # 3. ability to write eps graphs
144
+ # 1. pdflatex version 2014 or higher 2. gnuplot 3. ability to write eps
145
+ # graphs
146
146
  #
147
- # The graphs which are written out to the PDF are read in from a given CRMOD. It should be defined in the main .rb file for the CRMOD, e.g. gs2.rb.
148
- # As seen below, this function should be called 'latex_graphs'. To see an example of what this function should look like see GS2CRMOD, but it is simply an array of graphkits
149
- # and latex code blocks which describe plots.
147
+ # The graphs which are written out to the PDF are read in from a given CRMOD.
148
+ # It should be defined in the main .rb file for the CRMOD, e.g. gs2.rb. As
149
+ # seen below, this function should be called 'latex_graphs'. To see an
150
+ # example of what this function should look like see GS2CRMOD, but it is
151
+ # simply an array of graphkits and latex code blocks which describe plots.
150
152
  def self.write_report(copts={})
151
153
  runner = fetch_runner(copts)
152
154
  runs = runner.filtered_ids.map{|id| runner.combined_run_list[id]}
@@ -1096,125 +1096,128 @@ Conditions contain a single = sign: #{conditions}
1096
1096
  end
1097
1097
  logf(:submit)
1098
1098
  Dir.chdir(@root_folder) do
1099
- @skip=skip
1100
- mess = false
1101
- while FileTest.exist?("submitting")
1102
- (eputs " Waiting for another process to finish submitting. If you know that no other CodeRunner processes are submitting in this folder (#@root_folder) then delete the file 'submitting' and try again"; mess = true) unless mess
1103
- sleep rand
1104
- end
1105
- # old_trap = trap(0)
1106
- #old_trap0 = trap(0){eputs "Aborted Submit (0)!"; File.delete("#@root_folder/submitting"); exit!}
1107
- old_trap2 = trap(2){eputs "Aborted Submit (2)!"; File.delete("#@root_folder/submitting") if FileTest.exist? "#@root_folder/submitting"; trap(2, "DEFAULT"); trap(0, "DEFAULT"); Process.kill(2, 0)}
1108
- # File.open("submitting", "w"){|file| file.puts ""}
1109
- FileUtils.touch("submitting")
1110
- unless options[:no_update_before_submit]
1111
- @use_large_cache, ulc = false, @use_large_cache; update; @use_large_cache = ulc
1112
- end
1113
- generate_combined_ids(:real)
1114
- # old_job_nos = queue_status.scan(/^\s*(\d+)/).map{|match| match[0].to_i}
1115
- script = "" if options[:job_chain]
1116
- runs.each_with_index do |run, index|
1117
- similar = similar_runs([], run)
1118
- if @skip and similar[0] and not (options[:replace_existing] or options[:rerun])
1119
- eputs "Found similar run: #{@run_list[similar[0]].run_name}"
1120
- eputs "Skipping submission..."
1121
- runs[index] = nil
1122
- next
1123
- end
1124
- unless options[:replace_existing] or options[:rerun]
1125
- @max_id+=1
1126
- run.id = @max_id
1127
- else
1128
- if options[:replace_existing]
1129
- FileUtils.rm_r run.directory
1130
- elsif options[:rerun]
1131
- ################# For backwards compatibility
1132
- SUBMIT_OPTIONS.each do |opt|
1133
- run.set(opt, send(opt)) unless run.send(opt)
1134
- end
1135
- ###########################################
1136
- FileUtils.rm "#{run.directory}/code_runner_results.rb"
1137
- FileUtils.rm "#{run.directory}/.code_runner_run_data"
1138
- end
1139
- @run_list.delete(run.id)
1140
- @ids.delete run.id
1141
- generate_combined_ids
1142
- end
1143
-
1144
- begin
1145
-
1146
- unless options[:job_chain]
1147
- run.prepare_submission unless options[:rerun]
1148
- next if @test_submission
1149
- Dir.chdir(run.directory) do
1150
- old_job_nos = queue_status.scan(/^\s*(\d+)/).map{|match| match[0].to_i}
1151
- ######################### The big tomale!
1152
- run.job_no = run.execute # Start the simulation and get the job_number
1153
- #########################
1154
- run.job_no = get_new_job_no(old_job_nos) unless run.job_no.kind_of? Integer # (if the execute command does not return the job number, look for it manually)
1155
- # eputs 'run.job_no', run.job_no
1156
- run.output_file = nil # reset the output file
1157
- run.output_file # Sets the output_file on first call
1158
- run.error_file = nil # reset the output file
1159
- run.error_file # Sets the error_file on first call
1160
- run.write_info
1161
- eputs "Submitted run: #{run.run_name}"
1162
- end
1163
- else
1164
- run.prepare_submission unless options[:rerun]
1165
- script << "cd #{run.directory}\n"
1166
- script << "#{run.run_command}\n"
1167
- next if @test_submission
1168
- end
1169
- rescue => err
1170
- File.delete("submitting")
1171
- raise(err)
1172
- end
1173
- end # runs.each
1174
- runs.compact!
1175
- if options[:job_chain] and not @test_submission and runs.size > 0
1176
- FileUtils.makedirs('job_chain_files')
1177
- @id_list = runs.map{|run| run.id}
1178
-
1179
- #@executable ||= runs[0].executable
1180
- @submission_script = script
1181
- # A hook... default is to do nothing
1182
- @submission_script = @run_class.modify_job_script(self, runs, @submission_script)
1183
- # To get out of job_chain_files folder
1184
- @submission_script = "cd .. \n" + @submission_script
1185
- @code_run_environment = runs[0].code_run_environment
1186
- old_job_nos = queue_status.scan(/^\s*(\d+)/).map{|match| match[0].to_i}
1187
- ################ Submit the run
1188
- Dir.chdir('job_chain_files'){job_no = execute}
1189
- ################
1190
- job_no = get_new_job_no(old_job_nos) unless job_no.kind_of? Integer # (if the execute command does not return the job number, look for it manually)
1191
- # eputs 'jobchain no', job_no
1192
- #runs.each{|run| run.job_no = job_no}
1193
- runs.each do |run|
1194
- run.job_no = @job_no = job_no
1195
- run.output_file = run.relative_directory.split("/").map{|d| ".."}.join("/") + "/job_chain_files/" + output_file
1196
- run.error_file = run.relative_directory.split("/").map{|d| ".."}.join("/") + "/job_chain_files/" + error_file
1197
- run.write_info
1198
- eputs "Submitted run: #{run.run_name}"
1199
- end
1200
- end
1201
- @write_status_dots, wsd = false, @write_status_dots
1202
- @run_class.update_status(self)
1203
- runs.each do |run|
1204
- # ep run.id, run_list.keys
1205
- Dir.chdir(run.directory){traverse_directories}
1206
-
1207
- end
1208
- if is_in_repo? @root_folder and not @test_submission
1099
+ begin
1100
+ @skip=skip
1101
+ mess = false
1102
+ while FileTest.exist?("submitting")
1103
+ (eputs " Waiting for another process to finish submitting. If you know that no other CodeRunner processes are submitting in this folder (#@root_folder) then delete the file 'submitting' and try again"; mess = true) unless mess
1104
+ sleep rand
1105
+ end
1106
+ # old_trap = trap(0)
1107
+ #old_trap0 = trap(0){eputs "Aborted Submit (0)!"; File.delete("#@root_folder/submitting"); exit!}
1108
+ old_trap2 = trap(2){eputs "Aborted Submit (2)!"; File.delete("#@root_folder/submitting") if FileTest.exist? "#@root_folder/submitting"; trap(2, "DEFAULT"); trap(0, "DEFAULT"); Process.kill(2, 0)}
1109
+ # File.open("submitting", "w"){|file| file.puts ""}
1110
+ FileUtils.touch("submitting")
1111
+ unless options[:no_update_before_submit]
1112
+ @use_large_cache, ulc = false, @use_large_cache; update; @use_large_cache = ulc
1113
+ end
1114
+ generate_combined_ids(:real)
1115
+ # old_job_nos = queue_status.scan(/^\s*(\d+)/).map{|match| match[0].to_i}
1116
+ script = "" if options[:job_chain]
1117
+ runs.each_with_index do |run, index|
1118
+ similar = similar_runs([], run)
1119
+ if @skip and similar[0] and not (options[:replace_existing] or options[:rerun])
1120
+ eputs "Found similar run: #{@run_list[similar[0]].run_name}"
1121
+ eputs "Skipping submission..."
1122
+ runs[index] = nil
1123
+ next
1124
+ end
1125
+ unless options[:replace_existing] or options[:rerun]
1126
+ @max_id+=1
1127
+ run.id = @max_id
1128
+ else
1129
+ if options[:replace_existing]
1130
+ FileUtils.rm_r run.directory
1131
+ elsif options[:rerun]
1132
+ ################# For backwards compatibility
1133
+ SUBMIT_OPTIONS.each do |opt|
1134
+ run.set(opt, send(opt)) unless run.send(opt)
1135
+ end
1136
+ ###########################################
1137
+ FileUtils.rm "#{run.directory}/code_runner_results.rb"
1138
+ FileUtils.rm "#{run.directory}/.code_runner_run_data"
1139
+ end
1140
+ @run_list.delete(run.id)
1141
+ @ids.delete run.id
1142
+ generate_combined_ids
1143
+ end
1144
+
1145
+ begin
1146
+
1147
+ unless options[:job_chain]
1148
+ run.prepare_submission unless options[:rerun]
1149
+ next if @test_submission
1150
+ Dir.chdir(run.directory) do
1151
+ old_job_nos = queue_status.scan(/^\s*(\d+)/).map{|match| match[0].to_i}
1152
+ ######################### The big tomale!
1153
+ run.job_no = run.execute # Start the simulation and get the job_number
1154
+ #########################
1155
+ run.job_no = get_new_job_no(old_job_nos) unless run.job_no.kind_of? Integer # (if the execute command does not return the job number, look for it manually)
1156
+ # eputs 'run.job_no', run.job_no
1157
+ run.output_file = nil # reset the output file
1158
+ run.output_file # Sets the output_file on first call
1159
+ run.error_file = nil # reset the output file
1160
+ run.error_file # Sets the error_file on first call
1161
+ run.write_info
1162
+ eputs "Submitted run: #{run.run_name}"
1163
+ end
1164
+ else
1165
+ run.prepare_submission unless options[:rerun]
1166
+ script << "cd #{run.directory}\n"
1167
+ script << "#{run.run_command}\n"
1168
+ next if @test_submission
1169
+ end
1170
+ rescue => err
1171
+ File.delete("submitting")
1172
+ raise(err)
1173
+ end
1174
+ end # runs.each
1175
+ runs.compact!
1176
+ if options[:job_chain] and not @test_submission and runs.size > 0
1177
+ FileUtils.makedirs('job_chain_files')
1178
+ @id_list = runs.map{|run| run.id}
1179
+
1180
+ #@executable ||= runs[0].executable
1181
+ @submission_script = script
1182
+ # A hook... default is to do nothing
1183
+ @submission_script = @run_class.modify_job_script(self, runs, @submission_script)
1184
+ # To get out of job_chain_files folder
1185
+ @submission_script = "cd .. \n" + @submission_script
1186
+ @code_run_environment = runs[0].code_run_environment
1187
+ old_job_nos = queue_status.scan(/^\s*(\d+)/).map{|match| match[0].to_i}
1188
+ ################ Submit the run
1189
+ Dir.chdir('job_chain_files'){job_no = execute}
1190
+ ################
1191
+ job_no = get_new_job_no(old_job_nos) unless job_no.kind_of? Integer # (if the execute command does not return the job number, look for it manually)
1192
+ # eputs 'jobchain no', job_no
1193
+ #runs.each{|run| run.job_no = job_no}
1194
+ runs.each do |run|
1195
+ run.job_no = @job_no = job_no
1196
+ run.output_file = run.relative_directory.split("/").map{|d| ".."}.join("/") + "/job_chain_files/" + output_file
1197
+ run.error_file = run.relative_directory.split("/").map{|d| ".."}.join("/") + "/job_chain_files/" + error_file
1198
+ run.write_info
1199
+ eputs "Submitted run: #{run.run_name}"
1200
+ end
1201
+ end
1202
+ @write_status_dots, wsd = false, @write_status_dots
1203
+ @run_class.update_status(self)
1209
1204
  runs.each do |run|
1210
- Dir.chdir(run.directory){run.add_to_repo}
1205
+ # ep run.id, run_list.keys
1206
+ Dir.chdir(run.directory){traverse_directories}
1207
+
1211
1208
  end
1212
- end
1213
- @write_status_dots = wsd
1214
- save_large_cache
1215
- File.delete("submitting")
1209
+ if is_in_repo? @root_folder and not @test_submission
1210
+ runs.each do |run|
1211
+ Dir.chdir(run.directory){run.add_to_repo}
1212
+ end
1213
+ end
1214
+ @write_status_dots = wsd
1215
+ save_large_cache
1216
+ File.delete("submitting")
1217
+ ensure
1216
1218
  #trap(0, old_trap0)
1217
- trap(2, old_trap2)
1219
+ trap(2, old_trap2)
1220
+ end
1218
1221
 
1219
1222
 
1220
1223
  end # Dir.chdir(@root_folder)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: coderunner
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.17.10
4
+ version: 0.17.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Edmund Highcock
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-01-21 00:00:00.000000000 Z
11
+ date: 2016-04-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: graphkit
@@ -287,7 +287,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
287
287
  version: '0'
288
288
  requirements: []
289
289
  rubyforge_project: coderunner
290
- rubygems_version: 2.4.8
290
+ rubygems_version: 2.2.0
291
291
  signing_key:
292
292
  specification_version: 4
293
293
  summary: A framework for the automated running and analysis of simulations.