nera 0.6.0 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt CHANGED
@@ -1,3 +1,8 @@
1
+ == 0.7.0
2
+ * 1 major enhancement:
3
+ * a function to show recently included job records is implemented.
4
+ * 2 bug fixes:
5
+
1
6
  == 0.6.0
2
7
  * 1 major enhancement:
3
8
  * Implemented a new API functions.
data/lib/nera.rb CHANGED
@@ -22,5 +22,5 @@ require 'nera_simulator_records'
22
22
  require 'nera_remote_connector'
23
23
 
24
24
  module NERA
25
- VERSION = '0.6.0'
25
+ VERSION = '0.7.0'
26
26
  end
data/lib/nera/nera_cui.rb CHANGED
@@ -394,6 +394,7 @@ HEADER
394
394
  "Upload jobs",
395
395
  "Download data",
396
396
  "Include data",
397
+ "Show recently included jobs",
397
398
  "Exit"]
398
399
  jlc = NERA::JobLayerController.new( @path_db_folder)
399
400
  rc = NERA::RemoteConnector.new( @path_db_folder)
@@ -542,6 +543,13 @@ HEADER
542
543
  Dialog::message("Inclusion failed.")
543
544
  end
544
545
  return :job_layer
546
+ when "Show recently included jobs"
547
+ list = jlc.recently_included_list
548
+ Dialog::message(" * id, simulator, parameter_id, run_id, included_at")
549
+ list.each do |rec|
550
+ Dialog::message(" - #{rec[:id]}, #{rec[:simulator]}, #{rec[:parameter_id]}, #{rec[:run_id]}, #{rec[:included_at].to_s}")
551
+ end
552
+ return :job_layer
545
553
  when "Exit"
546
554
  return :exit
547
555
  end
@@ -234,6 +234,10 @@ module NERA
234
234
  return @db_folder + "Tables/finished_jobs.yml"
235
235
  end
236
236
 
237
+ def path_to_recently_finished_jobs_file
238
+ return @db_folder + "Tables/recently_finished_jobs.yml"
239
+ end
240
+
237
241
  def path_to_hosts_yaml
238
242
  return @db_folder + "Tables/hosts.yml"
239
243
  end
@@ -164,6 +164,20 @@ module NERA
164
164
  return true
165
165
  end
166
166
 
167
+ # Return the array of the finished records.
168
+ # Each record is a Hash.
169
+ # Return the records which are included on the same day as the most recently included record.
170
+ def recently_included_list
171
+ recs = []
172
+ fname = @db_folders.path_to_recently_finished_jobs_file
173
+ if File.exist?( fname)
174
+ YAML.load_documents( File.open(fname,'r') ) do |obj|
175
+ recs << obj if obj
176
+ end
177
+ end
178
+ return recs
179
+ end
180
+
167
181
  private
168
182
  def expand_and_parse( fpath)
169
183
  bz2_path = fpath.sub( /^#{@db_folders.path_to_include_layer}/, '')
@@ -254,10 +268,27 @@ module NERA
254
268
  destroyed[:start_at] = jinfo[:start_at]
255
269
  destroyed[:host_name] = jinfo[:host_name]
256
270
  destroyed[:finish_at] = jinfo[:finish_at]
271
+ destroyed[:included_at] = DateTime.now
272
+ # append to finished_jobs.yml
257
273
  File.open( @db_folders.path_to_finished_jobs_file, "a") do |io|
258
274
  YAML.dump( destroyed, io)
259
275
  io.flush
260
276
  end
277
+
278
+ # append to recently_finished_jobs.yml
279
+ fname = @db_folders.path_to_recently_finished_jobs_file
280
+ obj = YAML.load( File.open( fname, 'r') ) if File.exist?(fname)
281
+ if obj and Date.parse(obj[:included_at].to_s) === destroyed[:included_at]
282
+ File.open( fname, 'a') do |io|
283
+ YAML.dump( destroyed, io)
284
+ io.flush
285
+ end
286
+ else
287
+ File.open( fname, 'w') do |io|
288
+ YAML.dump( destroyed, io)
289
+ io.flush
290
+ end
291
+ end
261
292
  end
262
293
 
263
294
  def remove_files( fpath)
@@ -205,6 +205,11 @@ class TC_NERA_DB_FOLDERS < Test::Unit::TestCase
205
205
  assert_equal( @db_folder+"/Tables/finished_jobs.yml", p)
206
206
  end
207
207
 
208
+ def test_path_to_recently_finished_jobs_file
209
+ p = @dbf.path_to_recently_finished_jobs_file
210
+ assert_equal( @db_folder+"/Tables/recently_finished_jobs.yml", p)
211
+ end
212
+
208
213
  def test_path_to_hosts_yaml
209
214
  p = @dbf.path_to_hosts_yaml
210
215
  assert_equal( @db_folder+"/Tables/hosts.yml",p)
@@ -171,8 +171,6 @@ class TC_NERA_JOB_LAYER_CONTROLLER < Test::Unit::TestCase
171
171
 
172
172
  end
173
173
 
174
-
175
-
176
174
  def test_include_list
177
175
  l = @jlc.include_list
178
176
  assert_equal( 0, l.size)
@@ -243,4 +241,31 @@ class TC_NERA_JOB_LAYER_CONTROLLER < Test::Unit::TestCase
243
241
  }
244
242
  end
245
243
 
244
+ def test_recently_included_list
245
+ a = @jlc.recently_included_list
246
+ assert_equal( [] , a)
247
+
248
+ prepare_zipped_file
249
+ @jlc.include_all
250
+
251
+ a = @jlc.recently_included_list
252
+ assert_equal( 3, a.size)
253
+ assert_equal( "Ising", a[0][:simulator])
254
+ assert_equal( 1, a[0][:parameter_id])
255
+ assert_equal( 1, a[0][:run_id])
256
+ assert_equal( 1, a[0][:number_of_runs])
257
+ assert( DateTime.now === DateTime.parse(a[0][:included_at].to_s))
258
+
259
+ assert_equal( "Ising", a[1][:simulator])
260
+ assert_equal( 1, a[1][:parameter_id])
261
+ assert_equal( 2, a[1][:run_id])
262
+ assert_equal( 1, a[1][:number_of_runs])
263
+ assert( DateTime.now === DateTime.parse(a[1][:included_at].to_s))
264
+
265
+ assert_equal( "Ising", a[2][:simulator])
266
+ assert_equal( 1, a[2][:parameter_id])
267
+ assert_equal( 3, a[2][:run_id])
268
+ assert_equal( 1, a[2][:number_of_runs])
269
+ assert( DateTime.now === DateTime.parse(a[2][:included_at].to_s))
270
+ end
246
271
  end
data/website/index.html CHANGED
@@ -34,7 +34,7 @@
34
34
  <div class="sidebar">
35
35
  <div id="version" class="clickable" onclick='document.location = "http://rubyforge.org/projects/nera"; return false'>
36
36
  <p>Get Version</p>
37
- <a href="http://rubyforge.org/projects/nera" class="numbers">0.6.0</a>
37
+ <a href="http://rubyforge.org/projects/nera" class="numbers">0.7.0</a>
38
38
  </div>
39
39
  </div>
40
40
  <h2>What</h2>
@@ -34,7 +34,7 @@
34
34
  <div class="sidebar">
35
35
  <div id="version" class="clickable" onclick='document.location = "http://rubyforge.org/projects/nera"; return false'>
36
36
  <p>Get Version</p>
37
- <a href="http://rubyforge.org/projects/nera" class="numbers">0.6.0</a>
37
+ <a href="http://rubyforge.org/projects/nera" class="numbers">0.7.0</a>
38
38
  </div>
39
39
  </div>
40
40
  <p>The database created by nera is a hierarchical database which consists of three layers.<br />
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nera
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yohsuke Murase
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2010-01-06 00:00:00 +09:00
12
+ date: 2010-01-07 00:00:00 +09:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency