cpee 2.1.141 → 2.1.144

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (70) hide show
  1. checksums.yaml +4 -4
  2. data/cockpit/compliance-view.html +8 -11
  3. data/cockpit/compliance.html +8 -11
  4. data/cockpit/conformance.html +299 -0
  5. data/cockpit/css/compliance.css +3 -64
  6. data/cockpit/css/llmmodel.css +17 -22
  7. data/cockpit/css/ui.css +9 -14
  8. data/cockpit/edit.html +7 -10
  9. data/cockpit/graph.html +3 -6
  10. data/cockpit/index.html +7 -10
  11. data/cockpit/js/compliance.js +85 -396
  12. data/cockpit/js/extended_columns.js +8 -7
  13. data/cockpit/js/instance.js +3 -4
  14. data/cockpit/js/llmmodel.js +32 -0
  15. data/cockpit/js/mp-conformance.js +84 -0
  16. data/cockpit/js/parameters.js +3 -1
  17. data/cockpit/js/ui.js +2 -2
  18. data/cockpit/llm.html +58 -48
  19. data/cockpit/llmmodel.html +41 -36
  20. data/cockpit/model.html +6 -9
  21. data/cockpit/only_llm.html +5 -8
  22. data/cockpit/rngs/aggregations.rng +15 -0
  23. data/cockpit/rngs/intervals.rng +12 -0
  24. data/cockpit/rngs/nlrequirements.rng +8 -0
  25. data/cockpit/rngs/requirements.rng +2 -2
  26. data/cockpit/rngs/rules.rng +30 -0
  27. data/cockpit/templates/Coopis 2010 Replay.xml +7 -7
  28. data/cockpit/templates/Coopis 2010.xml +7 -7
  29. data/cockpit/templates/Frames.xml +1 -1
  30. data/cockpit/templates/Frames1.xml +527 -0
  31. data/cockpit/templates/ML-pipe-multi.xml +9 -9
  32. data/cockpit/templates/Readonly Local.xml +4 -4
  33. data/cockpit/templates/Track Test Local.xml +6 -6
  34. data/cockpit/templates/Track Test.xml +5 -5
  35. data/cockpit/templates/UR-VUE 2020 Solution Baseline.xml +6 -6
  36. data/cockpit/templates/UR-VUE 2020 Solution NN.xml +5 -5
  37. data/cockpit/templates/UR-VUE 2020 Solution View.xml +1 -1
  38. data/cockpit/templates/UR-VUE 2020.xml +1 -1
  39. data/cockpit/templates/Wait.xml +1 -1
  40. data/cockpit/templates/Worklist Vote.xml +2 -2
  41. data/cockpit/templates/Worklist.xml +1 -1
  42. data/cockpit/templates/instantiate/Take_Sub.xml +1 -1
  43. data/cockpit/templates/instantiate.local/Take_Sub.xml +1 -1
  44. data/cockpit/themes/base.js +18 -10
  45. data/cockpit/themes/presetlr/theme.js +1 -0
  46. data/cockpit/track.html +3 -6
  47. data/cpee.gemspec +2 -2
  48. data/lib/cpee/implementation.rb +2 -1
  49. data/lib/cpee/implementation_callbacks.rb +4 -2
  50. data/lib/cpee/implementation_notifications.rb +2 -2
  51. data/lib/cpee/persistence.rb +1 -0
  52. data/lib/engine/instances.rng +5 -0
  53. data/lib/properties/description.rng +0 -1
  54. data/lib/properties/dslx.rng +0 -1
  55. data/lib/properties/properties.rng +1 -0
  56. data/lib/properties/set-properties.rng +1 -0
  57. data/lib/properties/set-some-properties.rng +1 -0
  58. data/lib/properties/set-testset.rng +1 -0
  59. data/lib/properties/state.rng +0 -2
  60. data/lib/properties.xml +0 -1
  61. data/server/executionhandlers/eval/connection.rb +3 -6
  62. data/server/executionhandlers/ruby/connection.rb +3 -6
  63. data/server/executionhandlers/ruby/controller.rb +22 -16
  64. data/server/resources/states.dot +0 -4
  65. data/server/resources/states.xml +2 -8
  66. data/server/resources/topics.xml +0 -3
  67. data/tools/cpee +115 -2
  68. metadata +11 -5
  69. data/cockpit/css/wfadaptor.css +0 -401
  70. data/cockpit/js/wfadaptor.js +0 -1680
@@ -37,6 +37,8 @@ class Controller
37
37
 
38
38
  @redis = opts[:redis]
39
39
  @votes = []
40
+ @votes_mutex = Mutex.new
41
+ @stopping = false
40
42
 
41
43
  @id = id
42
44
 
@@ -136,7 +138,7 @@ class Controller
136
138
  end
137
139
 
138
140
  def start
139
- if vote("state/change", :state => 'running')
141
+ if vote("state/change", :state => 'running') && !@stopping
140
142
  @thread = @instance.start
141
143
  @thread.join
142
144
  else
@@ -145,23 +147,17 @@ class Controller
145
147
  end
146
148
  end
147
149
 
148
- def sim
149
- if vote("state/change", :state => 'simulating')
150
- @thread = @instance.sim
151
- @thread.join
152
- else
153
- @thread = @instance.stop
154
- @thread.join
155
- end
156
- end
157
-
158
150
  def stop
151
+ @stopping = true
159
152
  ### tell the instance to stop
160
153
  @instance.stop
161
154
  ### end all votes or it will not work
162
155
  Thread.new do # doing stuff in trap context is a nono. but in a thread its fine :-)
163
- @votes.each do |key|
164
- CPEE::Message::send(:'vote-response',key,base,@id,uuid,info,true,@redis)
156
+ @votes_mutex.synchronize { @votes.dup }.each do |key|
157
+ # BEWARE111!!!1!! only send to worker 0, as voting goes through single worker
158
+ # (cause i am not smart enough to make it work with multiple workers. Also voting
159
+ # should not happen often, so the complexity is not worth it for now).
160
+ CPEE::Message::send(:'vote-response',key,base,@id,uuid,info,true,@redis,0)
165
161
  end
166
162
  end
167
163
  end
@@ -186,13 +182,23 @@ class Controller
186
182
  votes = pending.map { |c| c[:key] }
187
183
 
188
184
  if votes.length > 0
189
- @votes += votes
185
+ stopping = @votes_mutex.synchronize do
186
+ @votes.concat(votes) unless @stopping
187
+ @stopping
188
+ end
189
+ return true if stopping
190
190
  psredis = @opts[:redis_dyn].call "Instance #{@id} Vote"
191
191
  collect = []
192
192
  changes = []
193
193
  psredis.subscribe(votes.map{|e| 'vote-response:00:' + e }) do |on|
194
194
  on.subscribe do |channel, count|
195
- pending.each { |c| CPEE::Message::send(:vote,what,base,@id,uuid,info,c,@redis) } if count == votes.length
195
+ if count == votes.length
196
+ if @stopping
197
+ psredis.unsubscribe
198
+ else
199
+ pending.each { |c| CPEE::Message::send(:vote,what,base,@id,uuid,info,c,@redis) }
200
+ end
201
+ end
196
202
  end
197
203
  on.message do |what, message|
198
204
  index = message.index(' ')
@@ -201,7 +207,7 @@ class Controller
201
207
  cont, chg = vote_parse(m['content'])
202
208
  collect << cont
203
209
  changes << chg if chg && chg.any?
204
- @votes.delete m['name']
210
+ @votes_mutex.synchronize { @votes.delete m['name'] }
205
211
  cancel_callback m['name']
206
212
  if collect.length >= votes.length
207
213
  psredis.unsubscribe
@@ -1,15 +1,11 @@
1
1
  digraph States {
2
2
  ready -> running;
3
- ready -> simulating;
4
3
  ready -> abandoned;
5
4
  running -> stopping;
6
5
  stopped -> running;
7
- stopped -> simulating;
8
6
  stopped -> abandoned;
9
7
 
10
8
  running -> finishing;
11
- simulating -> ready;
12
- simulating -> stopped;
13
9
  finishing -> finished;
14
10
  stopping -> stopped;
15
11
  }
@@ -4,10 +4,9 @@
4
4
 
5
5
  <setable>
6
6
  <!-- the following states change through external input -->
7
- <ready><!-- in this state you can set the following four states -->
7
+ <ready><!-- in this state you can set the following three states -->
8
8
  <ready/>
9
9
  <running/>
10
- <simulating/>
11
10
  <abandoned/>
12
11
  </ready>
13
12
  <running><!-- in this state you can set the following state -->
@@ -16,9 +15,8 @@
16
15
  <stopping><!-- in this state you can set the following state -->
17
16
  <stopping/>
18
17
  </stopping>
19
- <stopped><!-- in this state you can set the following four states -->
18
+ <stopped><!-- in this state you can set the following three states -->
20
19
  <running/>
21
- <simulating/>
22
20
  <abandoned/>
23
21
  <stopped/>
24
22
  </stopped>
@@ -30,10 +28,6 @@
30
28
  <stopping/>
31
29
  <finishing/>
32
30
  </running>
33
- <simulating>
34
- <ready/>
35
- <stopped/>
36
- </simulating>
37
31
  <finishing>
38
32
  <finished/>
39
33
  </finishing>
@@ -68,9 +68,6 @@
68
68
  <topic id='handler'>
69
69
  <event>change</event>
70
70
  </topic>
71
- <topic id='simulating'>
72
- <event>step</event>
73
- </topic>
74
71
  <topic id='task'>
75
72
  <event>instantiation</event>
76
73
  <event>error</event>
data/tools/cpee CHANGED
@@ -31,7 +31,7 @@ end
31
31
  ARGV.options { |opt|
32
32
  opt.summary_indent = ' ' * 2
33
33
  opt.summary_width = 20
34
- opt.banner = "Usage:\n#{opt.summary_indent}#{File.basename($0)} [options] convert | ui | cpui DIR | new DIR | archive DIR URL | start URL | delete! URL | abandon URL | a_by_name URL STRING\n"
34
+ opt.banner = "Usage:\n#{opt.summary_indent}#{File.basename($0)} [options] convert | ui | cpui DIR | new DIR | archive DIR URL | start URL | delete! URL | abandon URL | a_by_name URL STRING | housekeeping DIR URL DAYS\n"
35
35
  opt.on("Options:")
36
36
  opt.on("--help", "-h", "This text") { puts opt; exit }
37
37
  opt.on("")
@@ -39,6 +39,8 @@ ARGV.options { |opt|
39
39
  opt.on("")
40
40
  opt.on(wrap("[abandon! URL] running processes are stopped; ready or stopped processes are abandoned. Examples:\ncpee abandon! http://localhost:9298/1/\ncpee abandon http://localhost:9298/1-200\ncpee abandon http://localhost:9298/*"))
41
41
  opt.on("")
42
+ opt.on(wrap("[housekeeping DIR URL DAYS] processes whose state did not change for more than DAYS days are stopped and abandoned. Afterwards the properties of all finished and abandoned processes are saved into DIR and the processes are deleted. Processes with the attribute highlander set to true are not touched. Examples:\ncpee housekeeping ./archive http://localhost:9298/1/ 7\ncpee housekeeping ./archive http://localhost:9298/1-200 7\ncpee housekeeping ./archive http://localhost:9298/* 7"))
43
+ opt.on("")
42
44
  opt.on(wrap("[abandon URL] ready or stopped processes are abandoned. Examples:\ncpee abandon http://localhost:9298/1/\ncpee abandon http://localhost:9298/1-200\ncpee abandon http://localhost:9298/*"))
43
45
  opt.on("")
44
46
  opt.on(wrap("[stopping URL] print all stopping proccess ids"))
@@ -64,13 +66,15 @@ if (ARGV.length == 0) ||
64
66
  (ARGV.length == 1 && !(%w(ui convert vacuum).include?(ARGV[0]))) ||
65
67
  (ARGV.length == 2 && !(%w(abandon abandon! stopping start delete! cpui new).include?(ARGV[0]))) ||
66
68
  (ARGV.length == 3 && !(%w(archive a_by_name).include?(ARGV[0]))) ||
67
- (ARGV.length > 3)
69
+ (ARGV.length == 4 && !(%w(housekeeping).include?(ARGV[0]))) ||
70
+ (ARGV.length > 4)
68
71
  puts ARGV.options
69
72
  exit
70
73
  end
71
74
  command = ARGV[0]
72
75
  p1 = ARGV[1]
73
76
  p2 = ARGV[2]
77
+ p3 = ARGV[3]
74
78
  cockpit = "#{curpath}/../cockpit/"
75
79
 
76
80
  def js_libs(cockpit)
@@ -289,6 +293,115 @@ elsif command == 'abandon!'
289
293
  end
290
294
  end
291
295
  end
296
+ elsif command == 'housekeeping'
297
+ dir = p1
298
+ url = p2
299
+ unless File.directory?(dir)
300
+ puts 'DIR has to be an existing directory.'
301
+ exit
302
+ end
303
+ days = Float(p3) rescue nil
304
+ if days.nil? || days < 0
305
+ puts 'DAYS has to be a non-negative number.'
306
+ exit
307
+ end
308
+ limit = Time.now - (days * 60 * 60 * 24)
309
+ active = %w(ready running stopping stopped)
310
+ done = %w(finished abandoned)
311
+ url = File.join(url,'*') if url =~ /([a-zA-Z]|\/)$/
312
+ base = File.dirname(url)
313
+ candidates = []
314
+ archivable = []
315
+ highlanders = {}
316
+ if File.basename(url) == '*'
317
+ res = Typhoeus.get(File.join(base,'/'), headers: { 'see-instances' => 'true' })
318
+ if res.success?
319
+ XML::Smart.string(res.response_body) do |doc|
320
+ doc.find('//instance').each do |ele|
321
+ id = ele.attributes['id']
322
+ if done.include?(ele.attributes['state'])
323
+ archivable << id
324
+ elsif active.include?(ele.attributes['state']) && (Time.parse(ele.attributes['state_changed']) rescue Time.now) < limit
325
+ candidates << id
326
+ else
327
+ next
328
+ end
329
+ highlanders[id] = ele.attributes['highlander'].strip == 'true' unless ele.attributes['highlander'].nil?
330
+ end
331
+ end
332
+ candidates.reverse!
333
+ archivable.reverse!
334
+ else
335
+ exit
336
+ end
337
+ else
338
+ names = []
339
+ if File.basename(url) =~ /(\d+)-(\d+)/
340
+ names = ($1.to_i..$2.to_i).to_a
341
+ else
342
+ names << File.basename(url).to_i
343
+ end
344
+ names.each do |name|
345
+ print "Checking: " + name.to_s + "\r"
346
+ state = Typhoeus.get(File.join(base,name.to_s,'properties','state','/'))
347
+ next unless state.success?
348
+ if done.include?(state.response_body)
349
+ archivable << name
350
+ next
351
+ end
352
+ next unless active.include?(state.response_body)
353
+ changed = Typhoeus.get(File.join(base,name.to_s,'properties','state','@changed','/'))
354
+ next unless changed.success?
355
+ next unless (Time.parse(changed.response_body) rescue Time.now) < limit
356
+ candidates << name
357
+ end
358
+ puts
359
+ end
360
+ highlander = lambda do |name|
361
+ next highlanders[name] if highlanders.key?(name)
362
+ hl = Typhoeus.get(File.join(base,name.to_s,'properties','attributes','highlander','/'))
363
+ hl.success? && hl.response_body.strip == 'true'
364
+ end
365
+ archivable.reject!(&highlander)
366
+ pending = candidates.reject(&highlander)
367
+ deadline = Time.now + 60
368
+ until pending.empty? || Time.now > deadline
369
+ pending.delete_if do |name|
370
+ state = Typhoeus.get(File.join(base,name.to_s,'properties','state','/'))
371
+ if !state.success?
372
+ true
373
+ elsif state.response_body == 'ready' || state.response_body == 'stopped'
374
+ print "Abandoning: " + name.to_s + "\r"
375
+ ab = Typhoeus.put(File.join(base,name.to_s,'properties','state','/'), headers: {'Content-Type' => 'application/x-www-form-urlencoded'}, body: "value=abandoned")
376
+ archivable << name if ab.success?
377
+ true
378
+ elsif state.response_body == 'running'
379
+ print "Stopping: " + name.to_s + "\r"
380
+ Typhoeus.put(File.join(base,name.to_s,'properties','state','/'), headers: {'Content-Type' => 'application/x-www-form-urlencoded'}, body: "value=stopping")
381
+ false
382
+ elsif state.response_body == 'stopping'
383
+ false
384
+ else
385
+ true
386
+ end
387
+ end
388
+ sleep 1 unless pending.empty?
389
+ end
390
+ puts
391
+ puts "Still stopping (retry later): " + pending.join(', ') unless pending.empty?
392
+ archivable.each do |name|
393
+ print "Archiving: " + name.to_s + "\r"
394
+ prop = Typhoeus.get(File.join(base,name.to_s,'properties','/'))
395
+ next unless prop.success? && prop.headers['Content-Type'] =~ /^(text|application)\/xml/
396
+ xprop = XML::Smart::string(prop.response_body)
397
+ xprop.register_namespace 'p', 'http://cpee.org/ns/properties/2.0'
398
+ next unless done.include?(xprop.find("string(/p:properties/p:state)"))
399
+ uuid = xprop.find("string(/p:properties/p:attributes/p:uuid)")
400
+ next if uuid.empty?
401
+ File.write(File.join(dir,uuid + '.xml'),prop.response_body)
402
+ Typhoeus.delete(File.join(base,name.to_s,'/'))
403
+ end
404
+ puts
292
405
  elsif command == 'stopping'
293
406
  p1 = File.join(p1,'*') if p1 =~ /([a-zA-Z]|\/)$/
294
407
  base = File.dirname(p1)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cpee
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.141
4
+ version: 2.1.144
5
5
  platform: ruby
6
6
  authors:
7
7
  - Juergen eTM Mangler
@@ -40,7 +40,7 @@ dependencies:
40
40
  version: '1.99'
41
41
  - - ">="
42
42
  - !ruby/object:Gem::Version
43
- version: 1.99.158
43
+ version: 1.99.161
44
44
  type: :runtime
45
45
  prerelease: false
46
46
  version_requirements: !ruby/object:Gem::Requirement
@@ -50,7 +50,7 @@ dependencies:
50
50
  version: '1.99'
51
51
  - - ">="
52
52
  - !ruby/object:Gem::Version
53
- version: 1.99.158
53
+ version: 1.99.161
54
54
  - !ruby/object:Gem::Dependency
55
55
  name: highline
56
56
  requirement: !ruby/object:Gem::Requirement
@@ -250,6 +250,7 @@ files:
250
250
  - cockpit/compliance.html
251
251
  - cockpit/config.json
252
252
  - cockpit/config.json.example
253
+ - cockpit/conformance.html
253
254
  - cockpit/contrib/graph_example.svg
254
255
  - cockpit/contrib/legend.svg
255
256
  - cockpit/contrib/symbols.svg
@@ -269,7 +270,6 @@ files:
269
270
  - cockpit/css/model.css
270
271
  - cockpit/css/track.css
271
272
  - cockpit/css/ui.css
272
- - cockpit/css/wfadaptor.css
273
273
  - cockpit/edit.html
274
274
  - cockpit/graph.html
275
275
  - cockpit/index.html
@@ -282,21 +282,26 @@ files:
282
282
  - cockpit/js/llm-ui-status.js
283
283
  - cockpit/js/llm-ui.js
284
284
  - cockpit/js/llm.js
285
+ - cockpit/js/llmmodel.js
285
286
  - cockpit/js/model.js
286
287
  - cockpit/js/modifiers.js
288
+ - cockpit/js/mp-conformance.js
287
289
  - cockpit/js/parameters.js
288
290
  - cockpit/js/track.js
289
291
  - cockpit/js/ui.js
290
- - cockpit/js/wfadaptor.js
291
292
  - cockpit/llm.html
292
293
  - cockpit/llmmodel.html
293
294
  - cockpit/model.html
294
295
  - cockpit/only_llm.html
296
+ - cockpit/rngs/aggregations.rng
295
297
  - cockpit/rngs/attributes.rng
296
298
  - cockpit/rngs/dataelements.rng
297
299
  - cockpit/rngs/documents.rng
298
300
  - cockpit/rngs/endpoints.rng
301
+ - cockpit/rngs/intervals.rng
302
+ - cockpit/rngs/nlrequirements.rng
299
303
  - cockpit/rngs/requirements.rng
304
+ - cockpit/rngs/rules.rng
300
305
  - cockpit/templates.legacy/Async.xml
301
306
  - cockpit/templates.legacy/BCO.xml
302
307
  - cockpit/templates.legacy/BCS.xml
@@ -342,6 +347,7 @@ files:
342
347
  - cockpit/templates/Coopis 2010 Replay.xml
343
348
  - cockpit/templates/Coopis 2010.xml
344
349
  - cockpit/templates/Frames.xml
350
+ - cockpit/templates/Frames1.xml
345
351
  - cockpit/templates/IUPC arXiv:1104.3609 P34 1.xml
346
352
  - cockpit/templates/IUPC arXiv:1104.3609 P34 2.xml
347
353
  - cockpit/templates/IUPC arXiv:1104.3609 P34 3.xml