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 +4 -4
- data/VERSION +1 -1
- data/coderunner.gemspec +4 -4
- data/include/code_runner_ext.h +2 -2
- data/lib/coderunner/class_methods.rb +13 -11
- data/lib/coderunner/instance_methods.rb +119 -116
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b46beec4f2b3baa9e4bf6933b06a0f7cb8907504
|
4
|
+
data.tar.gz: 1450dbcc231b6ff03b6a484c0defacbccb016845
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b6908d3436c7545bad131dc1e5063403a841dca0a5a384094cc5af6871a6dffd5821fd85079cf36926f1023f0b14d687b1c80bdea2f7b58f89615329c36b5a9e
|
7
|
+
data.tar.gz: 5f4b357155f3844f46eb46c2c99a9b107ef7149cbb07869a4072880a6a634f39a9b554e22d409d0f06c179e301bff6aec7e7e9e8183e5fa4daa4e45a606f1b33
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.17.
|
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.
|
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
|
+
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
|
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.
|
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
|
data/include/code_runner_ext.h
CHANGED
@@ -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),
|
13
|
-
#define RFCALL_12_ON(obj, name, arg1, arg2) (rb_funcall(obj, rb_intern(name),
|
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
|
-
|
132
|
+
system "#{concat_string}"
|
133
133
|
end
|
134
134
|
|
135
|
-
# This section defines the report report writing function in. The latex
|
136
|
-
#
|
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
|
-
#
|
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
|
-
#
|
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.
|
148
|
-
#
|
149
|
-
#
|
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
|
-
|
1100
|
-
|
1101
|
-
|
1102
|
-
|
1103
|
-
|
1104
|
-
|
1105
|
-
|
1106
|
-
|
1107
|
-
|
1108
|
-
|
1109
|
-
|
1110
|
-
|
1111
|
-
|
1112
|
-
|
1113
|
-
|
1114
|
-
|
1115
|
-
|
1116
|
-
|
1117
|
-
|
1118
|
-
|
1119
|
-
|
1120
|
-
|
1121
|
-
|
1122
|
-
|
1123
|
-
|
1124
|
-
|
1125
|
-
|
1126
|
-
|
1127
|
-
|
1128
|
-
|
1129
|
-
|
1130
|
-
|
1131
|
-
|
1132
|
-
|
1133
|
-
|
1134
|
-
|
1135
|
-
|
1136
|
-
|
1137
|
-
|
1138
|
-
|
1139
|
-
|
1140
|
-
|
1141
|
-
|
1142
|
-
|
1143
|
-
|
1144
|
-
|
1145
|
-
|
1146
|
-
|
1147
|
-
|
1148
|
-
|
1149
|
-
|
1150
|
-
|
1151
|
-
|
1152
|
-
|
1153
|
-
|
1154
|
-
|
1155
|
-
|
1156
|
-
|
1157
|
-
|
1158
|
-
|
1159
|
-
|
1160
|
-
|
1161
|
-
|
1162
|
-
|
1163
|
-
|
1164
|
-
|
1165
|
-
|
1166
|
-
|
1167
|
-
|
1168
|
-
|
1169
|
-
|
1170
|
-
|
1171
|
-
|
1172
|
-
|
1173
|
-
|
1174
|
-
|
1175
|
-
|
1176
|
-
|
1177
|
-
|
1178
|
-
|
1179
|
-
|
1180
|
-
|
1181
|
-
|
1182
|
-
|
1183
|
-
|
1184
|
-
|
1185
|
-
|
1186
|
-
|
1187
|
-
|
1188
|
-
|
1189
|
-
|
1190
|
-
|
1191
|
-
#
|
1192
|
-
|
1193
|
-
|
1194
|
-
|
1195
|
-
|
1196
|
-
|
1197
|
-
|
1198
|
-
|
1199
|
-
|
1200
|
-
|
1201
|
-
|
1202
|
-
|
1203
|
-
|
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
|
-
|
1205
|
+
# ep run.id, run_list.keys
|
1206
|
+
Dir.chdir(run.directory){traverse_directories}
|
1207
|
+
|
1211
1208
|
end
|
1212
|
-
|
1213
|
-
|
1214
|
-
|
1215
|
-
|
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
|
-
|
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.
|
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
|
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.
|
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.
|