cpee 1.4.17 → 1.4.18

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9baa24fb02ca220f4344cd750fd772d1fc24de52452da1160b02f4a35c91a4d5
4
- data.tar.gz: 461b4ba6643115fd138c12279e1e390db6cd90467e03af22b0764c85c777b064
3
+ metadata.gz: 30952bfb498150aa39be236415fe6110733f848542c8b1cc875b4f112e3dfc3a
4
+ data.tar.gz: fe3f5fb06beaf18d6db8f168b107ca0b621e06f9da36c99a1e564ed2af82d184
5
5
  SHA512:
6
- metadata.gz: 5f27e270cae8b682f4dade5025886518a901a3490989fb07b677d36c6922c83d8be91f2520cd252f22ef46b4bd471cb9456bd417c571630ac9df0d157fd31f9d
7
- data.tar.gz: eda464b04ff47fcf180c0c3da1150ab51887d8627a1e31f28fe1479bddf034fe088ff89c79def55d195fd080d88dd9fe2c62ae6720181e267a24b2ad49a24db8
6
+ metadata.gz: d25f4a4c0e44459518b0df15d2a5c0b0c8d3e7ec80c6556b8453ee85c9db780acc697629089b02e609b67b2b87f4474fab0dd8e4291cb888b9978d84f33028a3
7
+ data.tar.gz: d8404a79cbe9e6429f5ac44f43423f2826f497b8476bd2aa2775fa371d3ef0b7d27d497a3cd550952cff428a8692b676677b07d61d75d624f2ab1e930fc6b5cc
@@ -69,6 +69,7 @@ function do_main_save() { //{{{
69
69
  manifestation.update_details(svgid);
70
70
  }
71
71
  adaptor_update();
72
+ format_instance_pos();
72
73
  });
73
74
 
74
75
  $.ajax({
@@ -17,6 +17,7 @@ var save = {};
17
17
  save['attributes'] = undefined;
18
18
  save['details'] = undefined;
19
19
  save['details_target'] = undefined;
20
+ save['instance_pos'] = [];
20
21
  var node_state = {};
21
22
  var sub_more = 'topic' + '=' + 'activity' + '&' +// {{{
22
23
  'events' + '=' + 'calling,status,manipulating,failed,done' + '&' +
@@ -392,6 +393,7 @@ function adaptor_init(url,theme,dslx) { //{{{
392
393
  });
393
394
  adaptor_update();
394
395
  manifestation.events.click(svgid);
396
+ format_instance_pos();
395
397
  };
396
398
  adaptor_update();
397
399
  monitor_instance_pos();
@@ -403,7 +405,7 @@ function adaptor_init(url,theme,dslx) { //{{{
403
405
  graphrealization.set_description($(dslx));
404
406
  adaptor_update();
405
407
  manifestation.events.click(svgid);
406
- monitor_instance_pos();
408
+ format_instance_pos();
407
409
  });
408
410
  }
409
411
  } //}}}
@@ -484,12 +486,9 @@ function monitor_instance_pos() {// {{{
484
486
  type: "GET",
485
487
  url: url + "/properties/values/positions/",
486
488
  success: function(res){
487
- var values = $("value > *",res);
489
+ save['instance_pos'] = $("value > *",res);
488
490
  format_visual_clear();
489
- values.each(function(){
490
- var what = this.nodeName;
491
- format_visual_add(what,save['state'] == 'running' ? 'active' : 'passive');
492
- });
491
+ format_instance_pos();
493
492
  }
494
493
  });
495
494
  }// }}}
@@ -554,6 +553,9 @@ function monitor_instance_pos_change(notification) {// {{{
554
553
  format_visual_add(b.position,"passive")
555
554
  });
556
555
  }
556
+ if (!parts['at'] && !parts['unmark'] && !parts['after'] && !parts['wait']) {
557
+ monitor_instance_pos();
558
+ }
557
559
  } // }}}
558
560
 
559
561
  function monitor_instance_vote_add(notification) {// {{{
@@ -1078,7 +1080,14 @@ function format_visual_vote_clear() {//{{{
1078
1080
  node_state = {};
1079
1081
  $('.super .vote').each(function(a,b){b.setAttribute("class","vote");});
1080
1082
  $("#votes").empty();
1081
- }//}}}
1083
+ }//}}}
1084
+
1085
+ function format_instance_pos() { //{{{
1086
+ $(save['instance_pos']).each(function(){
1087
+ var what = this.nodeName;
1088
+ format_visual_add(what,save['state'] == 'running' ? 'active' : 'passive');
1089
+ });
1090
+ } //}}}
1082
1091
 
1083
1092
  function format_visual_forms() { //{{{
1084
1093
  if (save['state'] != "ready" && save['state'] != "stopped") {
@@ -161,7 +161,7 @@ function WFAdaptorManifestation(adaptor) {
161
161
  'params': ['> finalize, > update', xml_node]
162
162
  });
163
163
  }
164
- if (xml_node.get(0).tagName == "call" || xml_node.get(0).tagName == "manipulate") {
164
+ if (xml_node.get(0).tagName == "call" || xml_node.get(0).tagName == "manipulate" || xml_node.get(0).tagName == "stop") {
165
165
  var icon = self.elements.call.illustrator.svg.clone();
166
166
  icon.children('g.replace').addClass('active');
167
167
  var vtarget = self.adaptor.illustrator.get_node_by_svg_id(svgid);
@@ -161,7 +161,7 @@ function WFAdaptorManifestation(adaptor) {
161
161
  'params': ['> finalize, > update', xml_node]
162
162
  });
163
163
  }
164
- if (xml_node.get(0).tagName == "call" || xml_node.get(0).tagName == "manipulate") {
164
+ if (xml_node.get(0).tagName == "call" || xml_node.get(0).tagName == "manipulate" || xml_node.get(0).tagName == "stop") {
165
165
  var icon = self.elements.call.illustrator.svg.clone();
166
166
  icon.children('g.replace').addClass('active');
167
167
  var vtarget = self.adaptor.illustrator.get_node_by_svg_id(svgid);
@@ -161,7 +161,7 @@ function WFAdaptorManifestation(adaptor) {
161
161
  'params': ['> finalize, > update', xml_node]
162
162
  });
163
163
  }
164
- if (xml_node.get(0).tagName == "call" || xml_node.get(0).tagName == "manipulate") {
164
+ if (xml_node.get(0).tagName == "call" || xml_node.get(0).tagName == "manipulate" || xml_node.get(0).tagName == "stop") {
165
165
  var icon = self.elements.call.illustrator.svg.clone();
166
166
  icon.children('g.replace').addClass('active');
167
167
  var vtarget = self.adaptor.illustrator.get_node_by_svg_id(svgid);
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "cpee"
3
- s.version = "1.4.17"
3
+ s.version = "1.4.18"
4
4
  s.platform = Gem::Platform::RUBY
5
5
  s.license = "LGPL-3.0"
6
6
  s.summary = "Preliminary release of cloud process execution engine (cpee). If you just need workflow execution, without a rest/xmpp service exposing it, then use WEEL"
@@ -107,7 +107,7 @@ module CPEE
107
107
  @directory + '/notifications/',
108
108
  opts[:notifications_init]
109
109
  )
110
- unless ['stopped','ready','finished'].include?(@properties.data.find("string(/p:properties/p:state)"))
110
+ unless ['stopped','ready','finished','abandoned'].include?(@properties.data.find("string(/p:properties/p:state)"))
111
111
  @properties.modify do |doc|
112
112
  doc.find("/p:properties/p:state").first.text = 'stopped'
113
113
  end
@@ -233,7 +233,7 @@ module CPEE
233
233
  @properties.data.find("string(/p:properties/p:state)")
234
234
  end
235
235
  def state_changed
236
- @properties.data.find("string(/p:properties/p:state/@changed)")
236
+ (str = @properties.data.find("string(/p:properties/p:state/@changed)")).empty? ? Time.at(0).xmlschema : str
237
237
  end
238
238
  def state_change!(state=nil)
239
239
  @properties.modify do |doc|
@@ -270,10 +270,10 @@ module CPEE
270
270
  end
271
271
  end #}}}
272
272
  def serialize_state! # {{{
273
- @properties.activate_schema(:finished) if @instance.state == :finished
274
- @properties.activate_schema(:inactive) if @instance.state == :stopped || @instance.state == :ready
275
- @properties.activate_schema(:active) if @instance.state == :running || @instance.state == :simulating
276
- if [:finished, :stopped, :ready].include?(@instance.state)
273
+ @properties.activate_schema(:finished) if @instance.state == :finished || @instance.state == :abandoned
274
+ @properties.activate_schema(:inactive) if @instance.state == :stopped || @instance.state == :ready
275
+ @properties.activate_schema(:active) if @instance.state == :running || @instance.state == :simulating
276
+ if [:finished, :stopped, :ready, :abandoned].include?(@instance.state)
277
277
  state_change! @instance.state
278
278
  end
279
279
  end # }}}
data/tools/cpee CHANGED
@@ -6,6 +6,7 @@ require 'fileutils'
6
6
  require 'webrick'
7
7
  require 'typhoeus'
8
8
  require 'xml/smart'
9
+ require 'pp'
9
10
 
10
11
  def wrap(s, width=78, indent=18)
11
12
  lines = []
@@ -27,11 +28,15 @@ end
27
28
 
28
29
  ARGV.options { |opt|
29
30
  opt.summary_indent = ' ' * 2
30
- opt.banner = "Usage:\n#{opt.summary_indent}#{File.basename($0)} [options] ui | cpui DIR | new DIR\n"
31
+ opt.banner = "Usage:\n#{opt.summary_indent}#{File.basename($0)} [options] ui | cpui DIR | new DIR | archive DIR URL | abandon URL\n"
31
32
  opt.on("Options:")
32
33
  opt.on("--help", "-h", "This text") { puts opt; exit }
33
34
  opt.on("")
34
- opt.on(wrap("[archive DIR URL] save properties from all finished instances listed at URL into DIR.\ne.g. cpee ./archive http://localhost:9298/"))
35
+ opt.on(wrap("[archive DIR URL] save properties from all finished instances listed at URL into DIR.\ne.g. cpee archive ./archive http://localhost:9298/"))
36
+ opt.on("")
37
+ opt.on(wrap("[abandon URL] running processes are stopped; ready or stopped processes are abandoned.\ne.g. cpee abandon http://localhost:9298/1/"))
38
+ opt.on("")
39
+ opt.on(wrap("[delete! URL] DANGER ZONE.\ne.g. cpee delete! http://localhost:9298/1/"))
35
40
  opt.on("")
36
41
  opt.on(wrap("[new DIR] scaffolds a sample execution engine. Everything except instances can be removed for default behaviour."))
37
42
  opt.on("")
@@ -42,51 +47,69 @@ ARGV.options { |opt|
42
47
  opt.on(wrap("[ui] starts a simple static web server with the ui on http://localhost:8080. Use [cpui DIR] if you want stuff in apache or nginx."))
43
48
  opt.parse!
44
49
  }
45
- if ARGV.length == 0 || (ARGV.length == 1 && ARGV[0] != 'ui') || (ARGV.length == 2 && %w(cpui new).include?(ARGV[1])) || (ARGV.length == 3 && ARGV[0] != 'archive') || ARGV.length > 3
50
+ if (ARGV.length == 0) ||
51
+ (ARGV.length == 1 && ARGV[0] != 'ui') ||
52
+ (ARGV.length == 2 && %w(abandon delete! cpui new).include?(ARGV[1])) ||
53
+ (ARGV.length == 3 && ARGV[0] != 'archive') ||
54
+ (ARGV.length > 3)
46
55
  puts ARGV.options
47
56
  exit
48
57
  end
49
58
  command = ARGV[0]
50
- dir = ARGV[1]
51
- url = ARGV[2]
59
+ p1 = ARGV[1]
60
+ p2 = ARGV[2]
52
61
 
53
62
  if command == 'ui'
54
63
  s = WEBrick::HTTPServer.new(:Port => 8080, :DocumentRoot => "#{curpath}/../cockpit/")
55
64
  trap("INT"){ s.shutdown }
56
65
  s.start
57
66
  elsif command == 'cpui'
58
- if !File.exists?(dir)
59
- FileUtils.cp_r("#{curpath}/../cockpit/",dir)
67
+ if !File.exists?(p1)
68
+ FileUtils.cp_r("#{curpath}/../cockpit/",p1)
60
69
  else
61
70
  puts "Directory already exists."
62
71
  end
63
72
  elsif command == 'inst'
64
- if !File.exists?(dir)
65
- FileUtils.cp_r("#{curpath}/instantiation/",dir)
73
+ if !File.exists?(p1)
74
+ FileUtils.cp_r("#{curpath}/instantiation/",p1)
66
75
  else
67
76
  puts 'Directory already exists.'
68
77
  end
69
78
  elsif command == 'archive'
70
- res = Typhoeus.get(url)
79
+ res = Typhoeus.get(File.join(p2,'/'))
71
80
  if res.success?
72
- if res.headers['content-type'] == 'text/xml'
73
- XML::Smart.string(res.body) do |doc|
74
- puts doc.to_s
75
- tcount = 0
76
- fcount = 0
81
+ if res.headers['Content-Type'] =~ /^(text|application)\/xml/
82
+ XML::Smart.string(res.response_body) do |doc|
77
83
  doc.root.children.each do |i|
78
- p i.attributes['id']
79
- p i.attributes['state']
84
+ if ["finished","abandoned"].include?(i.attributes['state'])
85
+ prop = Typhoeus.get(File.join(p2,i.attributes['id'],'properties','/'))
86
+ if prop.success?
87
+ File.write(File.join(p1,i.attributes['uuid'] + '.xml'),prop.response_body) if prop.headers['Content-Type'] =~ /^(text|application)\/xml/
88
+ Typhoeus.delete(File.join(p2,i.attributes['id'],'/'))
89
+ end
90
+ end
80
91
  end
81
92
  end
82
93
  end
83
94
  end
95
+ elsif command == 'abandon'
96
+ res = Typhoeus.get(File.join(p1,'properties','values','state','/'))
97
+ if res.success?
98
+ case res.response_body
99
+ when "ready", "stopped" then
100
+ Typhoeus.put(File.join(p1,'properties','values','state','/'), headers: {'Content-Type' => 'application/x-www-form-urlencoded'}, body: "value=abandoned")
101
+ when "running" then
102
+ Typhoeus.put(File.join(p1,'properties','values','state','/'), headers: {'Content-Type' => 'application/x-www-form-urlencoded'}, body: "value=stopped")
103
+ end
104
+ end
105
+ elsif command == 'delete!'
106
+ Typhoeus.delete(File.join(p1,'/'))
84
107
  else
85
- if !File.exists?(dir)
86
- FileUtils.cp_r("#{curpath}/server/",dir)
87
- FileUtils.mkdir("#{dir}/instances") rescue nil
88
- FileUtils.mkdir("#{dir}/resources") rescue nil
89
- FileUtils.mkdir("#{dir}/handlerwrappers") rescue nil
108
+ if !File.exists?(p1)
109
+ FileUtils.cp_r("#{curpath}/server/",p1)
110
+ FileUtils.mkdir("#{p1}/instances") rescue nil
111
+ FileUtils.mkdir("#{p1}/resources") rescue nil
112
+ FileUtils.mkdir("#{p1}/handlerwrappers") rescue nil
90
113
  else
91
114
  puts 'Directory already exists.'
92
115
  end
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: 1.4.17
4
+ version: 1.4.18
5
5
  platform: ruby
6
6
  authors:
7
7
  - Juergen eTM Mangler
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: tools
13
13
  cert_chain: []
14
- date: 2018-11-12 00:00:00.000000000 Z
14
+ date: 2018-11-19 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: riddl