cpee 2.1.74 → 2.1.77

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: 0f1d52202968f85e94d8d27cb948b88151f0f22311adae38417f3979bd4d3cb2
4
- data.tar.gz: 17e41e203881e61545037a863729cbaa9dcdbd1b2f0e0ff947d7b1a607ff315d
3
+ metadata.gz: b2d89a96cf818f522774efe8d3ff16db84d5e05076adc7d67ea5672882bd5e3d
4
+ data.tar.gz: 3562319ace848faf37d6e470f33d924ffbf2d4b53f925ac8e76bf7dcad54cabc
5
5
  SHA512:
6
- metadata.gz: a78c6d6c8916c8e76f06dbbb71bce7dd4d47d042655bd307ad020b3e4cbd1295549871af927f52b2a5d81c302ab266ec46356f3a73ec7fa20a03d425c5e3cbee
7
- data.tar.gz: '087e00e92adea25818ed49f421e1ddb591685e5a8221499d5e9f2369d19274d676bb7f63d9c4217571c3cc4680f58508d1c913f5d22539ad38381ec771fa6945'
6
+ metadata.gz: 6c46e594dcf3d287742d3bcea20b753887f956031a815e75c4a621689a500ebe00694cd00ab61559be8e899a7cc0d570e7bd5c95620136ef17cee72b17909a7d
7
+ data.tar.gz: 2aa325aa049ac762f8cd03495b90c54f4756f5c95306103cb00538a052aa28416086e698f6dee5ddf6353c48f8fe71b7bf5d16964463928b2d4dd1215bb7a1a6
data/cpee.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "cpee"
3
- s.version = "2.1.74"
3
+ s.version = "2.1.77"
4
4
  s.platform = Gem::Platform::RUBY
5
5
  s.license = "LGPL-3.0-or-later"
6
6
  s.summary = "The cloud process execution engine (cpee.org). If you just need workflow execution, without a rest service exposing it, then use WEEL."
@@ -32,4 +32,5 @@ Gem::Specification.new do |s|
32
32
  s.add_runtime_dependency 'webrick', '~>1.7'
33
33
  s.add_runtime_dependency 'rbtrace', '~>0.4'
34
34
  s.add_runtime_dependency 'cpee-eval-ruby', '~> 1.0', '>= 1.0.4'
35
+ s.add_runtime_dependency 'by', '~> 1.1', '>= 1.1.0'
35
36
  end
@@ -86,8 +86,16 @@ module CPEE
86
86
  opts[:redis_pid] ||= 'redis.pid' # use e.g. /var/run/redis.pid if you do global. Look it up in your redis config
87
87
  opts[:redis_db_name] ||= 'redis.rdb' # use e.g. /var/lib/redis.rdb for global stuff. Look it up in your redis config
88
88
 
89
+ opts[:libs_preload] ||= ['weel', 'json', 'redis', 'securerandom', 'riddl/client', 'cpee/value_helper', 'cpee/attributes_helper', 'cpee/message', 'cpee/redis', 'cpee/persistence', 'yaml', 'charlock_holmes', 'psych', 'xml/smart', 'ostruct', 'bigdecimal', 'mimemagic', 'cpee-eval-ruby/translation', 'get_process_mem']
90
+
89
91
  CPEE::redis_connect opts, 'Server Main'
90
92
 
93
+ ### start by server
94
+ if opts[:libs_preload]&.is_a?(Array) && opts[:libs_preload].length > 0
95
+ puts '(re)starting by-server ... it will keep running, just to let you know ...'
96
+ `/usr/bin/env by-server '#{opts[:libs_preload].join("' '")}'`
97
+ end
98
+
91
99
  opts[:sse_keepalive_frequency] ||= 10
92
100
  opts[:sse_connections] = {}
93
101
 
@@ -181,6 +189,7 @@ module CPEE
181
189
  interface 'main' do
182
190
  run CPEE::Instances, opts if get '*'
183
191
  run CPEE::NewInstance, opts if post 'instance-new'
192
+ run CPEE::NewInstanceFull, opts if post 'instance-full-new'
184
193
  on resource 'executionhandlers' do
185
194
  run CPEE::ExecutionHandlers, opts if get
186
195
  end
@@ -298,8 +307,53 @@ module CPEE
298
307
  end
299
308
  end #}}}
300
309
 
310
+ class NewInstanceFull < Riddl::Implementation #{{{
311
+ def response
312
+ opts = @a[0]
313
+ redis = opts[:redis]
314
+
315
+ doc = XML::Smart::string(@p[0].value.read)
316
+ doc.register_namespace 'p', 'http://cpee.org/ns/properties/2.0'
317
+ doc.register_namespace 'sub', 'http://riddl.org/ns/common-patterns/notifications-producer/2.0'
318
+
319
+ id, uuid = NewInstance::create(opts,redis,doc.find('string(/*/p:attributes/p:info)'))
320
+
321
+ subscriptions = []
322
+ doc.find('/*/sub:subscriptions/sub:subscription').each do |s|
323
+ sub = []
324
+ unless sub[0] = s.attributes['id']
325
+ sub[0] = Digest::MD5.hexdigest(Kernel::rand().to_s)
326
+ end
327
+
328
+ unless sub[1] = s.attributes['url']
329
+ raise "no url"
330
+ end
331
+
332
+ sub[2] = []
333
+ s.find('sub:topic').each do |t|
334
+ %w(event vote).each do |type|
335
+ t.find('sub:' + type).each do |e|
336
+ sub[2] << File.join(t.attributes['id'],type,e.text)
337
+ end
338
+ end
339
+ end
340
+
341
+ CPEE::Persistence::set_handler(id,opts,*sub)
342
+ end
343
+
344
+ CPEE::Properties::Put::change_first(id,opts,doc)
345
+ CPEE::Properties::PutState::run(id,opts,'running') if doc.find('string(/*/p:state)') == 'running'
346
+
347
+ @headers << Riddl::Header.new("CPEE-INSTANCE", id.to_s)
348
+ @headers << Riddl::Header.new("CPEE-INSTANCE-URL", File.join(opts[:url].to_s,id.to_s,'/'))
349
+ @headers << Riddl::Header.new("CPEE-INSTANCE-UUID", uuid)
350
+
351
+ Riddl::Parameter::Simple.new("id", id.to_s)
352
+ end
353
+ end #}}}
354
+
301
355
  class NewInstance < Riddl::Implementation #{{{
302
- def path(e)
356
+ def self::path(e)
303
357
  ret = []
304
358
  until e.qname.name == 'properties'
305
359
  ret << (e.class == XML::Smart::Dom::Attribute ? '@' : '') + e.qname.name
@@ -308,12 +362,9 @@ module CPEE
308
362
  File.join(*ret.reverse)
309
363
  end
310
364
 
311
- def response
312
- opts = @a[0]
313
- redis = opts[:redis]
365
+ def self::create(opts,redis,name)
314
366
  doc = XML::Smart::open_unprotected(opts[:properties_init])
315
367
  doc.register_namespace 'p', 'http://cpee.org/ns/properties/2.0'
316
- name = @p[0].value
317
368
  id = CPEE::Persistence::new_object(opts)
318
369
  uuid = SecureRandom.uuid
319
370
  instance = CPEE::Persistence::obj + ':' + id.to_s
@@ -322,17 +373,17 @@ module CPEE
322
373
  doc.root.find(PROPERTIES_PATHS_FULL.join(' | ')).each do |e|
323
374
  if e.class == XML::Smart::Dom::Element && e.element_only?
324
375
  val = e.find('*').map { |f| f.dump }.join
325
- multi.set(File.join(instance, path(e)), val)
376
+ multi.set(File.join(instance, NewInstance::path(e)), val)
326
377
  else
327
- multi.set(File.join(instance, path(e)), e.text)
378
+ multi.set(File.join(instance, NewInstance::path(e)), e.text)
328
379
  end
329
380
  end
330
381
  doc.root.find(PROPERTIES_PATHS_INDEX_UNORDERED.join(' | ')).each do |e|
331
- p = path(e)
382
+ p = NewInstance::path(e)
332
383
  multi.sadd(File.join(instance, File.dirname(p)), File.basename(p))
333
384
  end
334
385
  doc.root.find(PROPERTIES_PATHS_INDEX_ORDERED.join(' | ')).each_with_index do |e,i|
335
- p = path(e)
386
+ p = NewInstance::path(e)
336
387
  multi.zadd(File.join(instance, File.dirname(p)), i, File.basename(p))
337
388
  end
338
389
  Dir[File.join(opts[:notifications_init],'*','subscription.xml')].each do |f|
@@ -355,13 +406,22 @@ module CPEE
355
406
  multi.zadd(File.join(instance, 'attributes'), -1, 'info')
356
407
  multi.set(File.join(instance, 'state', '@changed'), Time.now.xmlschema(3))
357
408
  end
358
-
359
409
  content = {
360
410
  :state => 'ready',
361
411
  :attributes => CPEE::Persistence::extract_list(id,opts,'attributes').to_h
362
412
  }
363
413
  CPEE::Message::send(:event,'state/change',File.join(opts[:url],'/'),id,uuid,name,content,redis)
364
414
 
415
+ return id, uuid
416
+ end
417
+
418
+ def response
419
+ opts = @a[0]
420
+ redis = opts[:redis]
421
+ name = @p[0].value
422
+
423
+ id, uuid = NewInstance::create(opts,redis,name)
424
+
365
425
  @headers << Riddl::Header.new("CPEE-INSTANCE", id.to_s)
366
426
  @headers << Riddl::Header.new("CPEE-INSTANCE-URL", File.join(opts[:url].to_s,id.to_s,'/'))
367
427
  @headers << Riddl::Header.new("CPEE-INSTANCE-UUID", uuid)
@@ -176,6 +176,7 @@ module CPEE
176
176
  CPEE::Properties::PatchPositions::set id, opts, node.first.dump
177
177
  end
178
178
  end
179
+ CPEE::Persistence::wait(opts)
179
180
 
180
181
  if (node = doc.find('/p:properties/p:state')).any?
181
182
  CPEE::Properties::PutState::run id, opts, node.first.text
@@ -184,6 +185,41 @@ module CPEE
184
185
  end
185
186
  end #}}}
186
187
  class Put < Riddl::Implementation #{{{
188
+ def self::change_first(id,opts,doc)
189
+ if (node = doc.find('/p:properties/p:status')).any?
190
+ CPEE::Properties::PutStatus::set id, opts, node.first.dump
191
+ end
192
+ if (node = doc.find('/p:properties/p:executionhandler')).any?
193
+ CPEE::Properties::PutExecutionHandler::set id, opts, node.first.text, false
194
+ end
195
+
196
+ %w{dataelements endpoints attributes}.each do |item|
197
+ if (node = doc.find('/p:properties/p:' + item)).any?
198
+ CPEE::Properties::PutItems::set item, id, opts, node.first.dump
199
+ end
200
+ end
201
+
202
+ if (node = doc.find('/p:properties/p:transformation')).any?
203
+ CPEE::Properties::PutTransformation::set id, opts, node.first.dump
204
+ end
205
+ if (node = doc.find('/p:properties/p:description/*')).any?
206
+ CPEE::Properties::PutDescription::set id, opts, node.first.dump
207
+ end
208
+
209
+ if (node = doc.find('/p:properties/p:positions')).any?
210
+ if node.first.find('p:*').any?
211
+ CPEE::Properties::PutPositions::set id, opts, node.first.dump
212
+ end
213
+ end
214
+ CPEE::Persistence::wait(opts)
215
+ end
216
+
217
+ def self::change_last(id,opts,doc)
218
+ if (node = doc.find('/p:properties/p:state')).any?
219
+ CPEE::Properties::PutState::run id, opts, node.first.text
220
+ end
221
+ end
222
+
187
223
  def response
188
224
  id = @a[0]
189
225
  opts = @a[1]
@@ -192,35 +228,8 @@ module CPEE
192
228
  else
193
229
  doc = XML::Smart::string(@p[0].value.read)
194
230
  doc.register_namespace 'p', 'http://cpee.org/ns/properties/2.0'
195
- if (node = doc.find('/p:properties/p:status')).any?
196
- CPEE::Properties::PutStatus::set id, opts, node.first.dump
197
- end
198
- if (node = doc.find('/p:properties/p:executionhandler')).any?
199
- CPEE::Properties::PutExecutionHandler::set id, opts, node.first.text
200
- end
201
-
202
- %w{dataelements endpoints attributes}.each do |item|
203
- if (node = doc.find('/p:properties/p:' + item)).any?
204
- CPEE::Properties::PutItems::set item, id, opts, node.first.dump
205
- end
206
- end
207
-
208
- if (node = doc.find('/p:properties/p:transformation')).any?
209
- CPEE::Properties::PutTransformation::set id, opts, node.first.dump
210
- end
211
- if (node = doc.find('/p:properties/p:description/*')).any?
212
- CPEE::Properties::PutDescription::set id, opts, node.first.dump
213
- end
214
-
215
- if (node = doc.find('/p:properties/p:positions')).any?
216
- if node.first.find('p:*').any?
217
- CPEE::Properties::PutPositions::set id, opts, node.first.dump
218
- end
219
- end
220
-
221
- if (node = doc.find('/p:properties/p:state')).any?
222
- CPEE::Properties::PutState::run id, opts, node.first.text
223
- end
231
+ CPEE::Properties::Put::change_first(id,opts,doc)
232
+ CPEE::Properties::Put::change_last(id,opts,doc)
224
233
  end
225
234
  end
226
235
  end #}}}
@@ -330,18 +339,21 @@ module CPEE
330
339
  end
331
340
  end #}}}
332
341
  class PutExecutionHandler < Riddl::Implementation #{{{
333
- def self::set(id,opts,hw)
342
+ def self::set(id,opts,hw,transform=true)
334
343
  CPEE::Persistence::set_item(id,opts,'executionhandler',:executionhandler => hw)
335
- desc = CPEE::Persistence::extract_item(id,opts,'description')
336
- dslx = CPEE::Persistence::extract_item(id,opts,'dslx')
337
- xml = XML::Smart::string(dslx)
338
- xml.register_namespace 'd', 'http://cpee.org/ns/description/1.0'
339
- dsl = Object.const_get('CPEE::ExecutionHandler::' + hw.capitalize)::dslx_to_dsl(xml)
340
- CPEE::Persistence::set_item(id,opts,'description',
341
- :description => xml,
342
- :dslx => dslx,
343
- :dsl => dsl
344
- )
344
+ if transform
345
+ desc = CPEE::Persistence::extract_item(id,opts,'description')
346
+ dslx = CPEE::Persistence::extract_item(id,opts,'dslx')
347
+ endpoints = CPEE::Persistence::extract_list(id,opts,'endpoints')
348
+ xml = XML::Smart::string(dslx)
349
+ xml.register_namespace 'd', 'http://cpee.org/ns/description/1.0'
350
+ dsl = Object.const_get('CPEE::ExecutionHandler::' + hw.capitalize)::dslx_to_dsl(xml,endpoints)
351
+ CPEE::Persistence::set_item(id,opts,'description',
352
+ :description => xml,
353
+ :dslx => dslx,
354
+ :dsl => dsl
355
+ )
356
+ end
345
357
  end
346
358
  def response
347
359
  id = @a[0]
@@ -663,7 +675,7 @@ module CPEE
663
675
  end #}}}
664
676
 
665
677
  class PutDescription < Riddl::Implementation #{{{
666
- def self::transform(descxml,tdesc,tdesctype,tdata,tdatatype,tendp,tendptype,hw,opts) #{{{
678
+ def self::transform(descxml,tdesc,tdesctype,tdata,tdatatype,tendp,tendptype,hw,id,opts) #{{{
667
679
  desc = XML::Smart::string(descxml) rescue nil
668
680
  if desc.nil?
669
681
  if descxml.empty?
@@ -681,6 +693,32 @@ module CPEE
681
693
  de = {}
682
694
  ep = {}
683
695
 
696
+ ### endpoints extraction
697
+ addit = if tendptype == 'rest' && !tdata.empty?
698
+ srv = Riddl::Client.interface(tendp,opts[:transformation_service])
699
+ status, res = srv.post [
700
+ Riddl::Parameter::Complex.new("description","text/xml",descxml),
701
+ Riddl::Parameter::Simple.new("type","endpoints")
702
+ ]
703
+ if status >= 200 && status < 300
704
+ res
705
+ else
706
+ raise 'Could not extract endpoints'
707
+ end
708
+ elsif tendptype == 'xslt' && !tdata.empty?
709
+ trans = XML::Smart::open_unprotected(tendp.text)
710
+ desc.transform_with(trans)
711
+ elsif tendptype == 'clean'
712
+ []
713
+ else
714
+ nil
715
+ end
716
+ unless addit.nil?
717
+ addit.each_slice(2).each do |k,v|
718
+ ep[k.value.to_sym] = v.value
719
+ end
720
+ end
721
+
684
722
  ### description transformation, including dslx to dsl
685
723
  addit = if tdesctype == 'copy' || tdesc.empty?
686
724
  desc || ''
@@ -705,7 +743,7 @@ module CPEE
705
743
  end
706
744
  unless addit.nil?
707
745
  dslx = addit.to_s
708
- dsl = Object.const_get('CPEE::ExecutionHandler::' + hw.capitalize)::dslx_to_dsl(addit)
746
+ dsl = Object.const_get('CPEE::ExecutionHandler::' + hw.capitalize)::dslx_to_dsl(addit,CPEE::Persistence::extract_list(id,opts,'endpoints').to_h.merge(ep))
709
747
  end
710
748
 
711
749
  ### dataelements extraction
@@ -734,32 +772,6 @@ module CPEE
734
772
  end
735
773
  end
736
774
 
737
- ### endpoints extraction
738
- addit = if tendptype == 'rest' && !tdata.empty?
739
- srv = Riddl::Client.interface(tendp,opts[:transformation_service])
740
- status, res = srv.post [
741
- Riddl::Parameter::Complex.new("description","text/xml",descxml),
742
- Riddl::Parameter::Simple.new("type","endpoints")
743
- ]
744
- if status >= 200 && status < 300
745
- res
746
- else
747
- raise 'Could not extract endpoints'
748
- end
749
- elsif tendptype == 'xslt' && !tdata.empty?
750
- trans = XML::Smart::open_unprotected(tendp.text)
751
- desc.transform_with(trans)
752
- elsif tendptype == 'clean'
753
- []
754
- else
755
- nil
756
- end
757
- unless addit.nil?
758
- addit.each_slice(2).each do |k,v|
759
- ep[k.value.to_sym] = v.value
760
- end
761
- end
762
-
763
775
  [dslx, dsl, de, ep]
764
776
  end #}}}
765
777
 
@@ -773,6 +785,7 @@ module CPEE
773
785
  CPEE::Persistence::extract_item(id,opts,'transformation/endpoints'),
774
786
  CPEE::Persistence::extract_item(id,opts,'transformation/endpoints/@type'),
775
787
  CPEE::Persistence::extract_item(id,opts,'executionhandler'),
788
+ id,
776
789
  opts
777
790
  )
778
791
  CPEE::Persistence::set_item(id,opts,'description',
data/lib/cpee/message.rb CHANGED
@@ -39,6 +39,23 @@ module CPEE
39
39
  @@last < @@tworkers-1 ? @@last += 1 : @@last = 0
40
40
  end
41
41
 
42
+ def self::wait(backend,sub,tt=nil)
43
+ target = '%02i' % (tt || CPEE::Message::target)
44
+ wid = Digest::MD5.hexdigest(Kernel::rand().to_s)
45
+ begin
46
+ sub.subscribe_with_timeout(2,'event:' + target + ':transaction/finished') do |on|
47
+ on.message do |what,message|
48
+ mess = message[0...message.index(' ')]
49
+ sub.unsubscribe('event:' + target + ':transaction/finished') if mess == wid
50
+ end
51
+ backend.publish('event:' + target + ':transaction/start',wid + ' {}')
52
+ end
53
+ rescue => e
54
+ puts "timeout error"
55
+ end
56
+ sub.disconnect!
57
+ end
58
+
42
59
  def self::send(type, event, cpee, instance, instance_uuid, instance_name, content={}, backend=nil, tt=nil)
43
60
  target = '%02i' % (tt || CPEE::Message::target)
44
61
  topic = ::File::dirname(event)
@@ -50,7 +67,7 @@ module CPEE
50
67
  'topic' => topic,
51
68
  'type' => type,
52
69
  'name' => name,
53
- 'timestamp' => Time.now.xmlschema(4),
70
+ 'timestamp' => Time.now.xmlschema(6),
54
71
  'content' => content
55
72
  }
56
73
  payload[@@type + '-uuid'] = instance_uuid if instance_uuid
@@ -23,6 +23,10 @@ module CPEE
23
23
  @@obj = it
24
24
  end #}}}
25
25
 
26
+ def self::wait(opts)
27
+ CPEE::Message::wait(opts[:redis],opts[:redis_dyn].call('Temporary Storage Transaction Subscriber'))
28
+ end
29
+
26
30
  def self::set_list(id,opts,item,values,deleted=[]) #{{{
27
31
  ah = AttributesHelper.new
28
32
  attributes = Persistence::extract_list(id,opts,'attributes').to_h
data/lib/engine.xml CHANGED
@@ -16,6 +16,10 @@
16
16
 
17
17
  <description datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes" xmlns="http://riddl.org/ns/description/1.0" xmlns:xi="http://www.w3.org/2001/XInclude" xmlns:doc="http://cpee.org/ns/documentation">
18
18
 
19
+ <message name="instance-new">
20
+ <parameter name="info" type="string"/>
21
+ </message>
22
+
19
23
  <message name="list-of-workflow-instances">
20
24
  <parameter name="wis" mimetype="text/xml" handler="http://riddl.org/ns/handlers/relaxng">
21
25
  <doc:documentation>d</doc:documentation>
@@ -27,8 +31,10 @@
27
31
  <parameter name="id" type="nonNegativeInteger"/>
28
32
  </message>
29
33
 
30
- <message name="instance-new">
31
- <parameter name="info" type="string"/>
34
+ <message name="instance-full-new">
35
+ <parameter name="testset" mimetype="*/xml" handler="http://riddl.org/ns/handlers/relaxng">
36
+ <xi:include href="properties/set-testset.rng"/>
37
+ </parameter>
32
38
  </message>
33
39
 
34
40
  <message name="instance-info">
@@ -48,6 +54,7 @@
48
54
  <doc:documentation>a</doc:documentation>
49
55
  </get>
50
56
  <post in="instance-new" out="instance-id"/>
57
+ <post in="instance-full-new" out="instance-id"/>
51
58
  <resource relative="executionhandlers">
52
59
  <get out="executionhandlerlist"/>
53
60
  </resource>
@@ -0,0 +1,49 @@
1
+ <grammar xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
2
+ <include href="state.rng"/>
3
+ <include href="status.rng"/>
4
+ <include href="executionhandler.rng"/>
5
+ <include href="positions.rng"/>
6
+ <include href="dataelements.rng"/>
7
+ <include href="endpoints.rng"/>
8
+ <include href="attributes.rng"/>
9
+ <include href="description.rng"/>
10
+ <include href="transformation.rng"/>
11
+ <include href="subscriptions.rng"/>
12
+
13
+ <start>
14
+ <element name="testset" ns="http://cpee.org/ns/properties/2.0">
15
+ <interleave>
16
+ <optional>
17
+ <ref name="subscriptions"/>
18
+ </optional>
19
+ <optional>
20
+ <ref name="set-state"/>
21
+ </optional>
22
+ <optional>
23
+ <ref name="status"/>
24
+ </optional>
25
+ <optional>
26
+ <ref name="executionhandler"/>
27
+ </optional>
28
+ <optional>
29
+ <ref name="positions"/>
30
+ </optional>
31
+ <optional>
32
+ <ref name="dataelements"/>
33
+ </optional>
34
+ <optional>
35
+ <ref name="endpoints"/>
36
+ </optional>
37
+ <optional>
38
+ <ref name="attributes"/>
39
+ </optional>
40
+ <optional>
41
+ <ref name="description"/>
42
+ </optional>
43
+ <optional>
44
+ <ref name="transformation"/>
45
+ </optional>
46
+ </interleave>
47
+ </element>
48
+ </start>
49
+ </grammar>
@@ -0,0 +1,43 @@
1
+ <grammar xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
2
+ <define name="subscriptions">
3
+ <element name="subscriptions" ns="http://riddl.org/ns/common-patterns/notifications-producer/2.0">
4
+ <zeroOrMore>
5
+ <ref name="subscription"/>
6
+ </zeroOrMore>
7
+ </element>
8
+ </define>
9
+
10
+ <define name="subscription">
11
+ <element name="subscription" ns="http://riddl.org/ns/common-patterns/notifications-producer/2.0">
12
+ <attribute name="id">
13
+ <data type="string">
14
+ <param name="pattern">[a-zA-Z0-9_]+</param>
15
+ </data>
16
+ </attribute>
17
+ <optional>
18
+ <attribute name="url">
19
+ <data type="string"/>
20
+ </attribute>
21
+ </optional>
22
+ <oneOrMore>
23
+ <element name="topic">
24
+ <attribute name="id">
25
+ <data type="string"/>
26
+ </attribute>
27
+ <oneOrMore>
28
+ <element>
29
+ <choice>
30
+ <name>event</name>
31
+ <name>vote</name>
32
+ </choice>
33
+ <data type="string">
34
+ <param name="pattern">[\w_]+</param>
35
+ </data>
36
+ </element>
37
+ </oneOrMore>
38
+ </element>
39
+ </oneOrMore>
40
+ </element>
41
+ </define>
42
+
43
+ </grammar>
@@ -23,7 +23,7 @@ module CPEE
23
23
  BACKEND_RUN = File.expand_path(File.join(__dir__,'backend','run'))
24
24
  BACKEND_TEMPLATE = File.expand_path(File.join(__dir__,'backend','instance.template'))
25
25
 
26
- def self::dslx_to_dsl(dslx) # transpile
26
+ def self::dslx_to_dsl(dslx,ep) # transpile
27
27
  trans = XML::Smart::open_unprotected(ExecutionHandler::Eval::DSL_TO_DSLX_XSL)
28
28
  dslx.transform_with(trans).to_s
29
29
  end
@@ -1,5 +1,5 @@
1
- #!/usr/bin/ruby
2
- require 'rbtrace'
1
+ #!/usr/bin/env by
2
+ # require 'rbtrace'
3
3
  require 'yaml'
4
4
  opts = YAML::load_file(File.join(__dir__,'opts.yaml'))
5
5
  opts[:pidf] = __FILE__ + '.pid'
@@ -810,7 +810,7 @@
810
810
  </xsl:when>
811
811
  <xsl:otherwise>
812
812
  <xsl:text>"</xsl:text>
813
- <xsl:value-of select="str:replace(str:replace(.,'\','\\'),'&quot;','\\\&quot;')"/>
813
+ <xsl:value-of select="str:replace(str:replace(.,'\','\\'),'&quot;','\&quot;')"/>
814
814
  <xsl:text>"</xsl:text>
815
815
  </xsl:otherwise>
816
816
  </xsl:choose>
@@ -830,11 +830,11 @@
830
830
  <xsl:choose>
831
831
  <xsl:when test="substring(.,1,1) = '!'">
832
832
  <xsl:text>>🠊("</xsl:text>
833
- <xsl:value-of select="str:replace(str:replace(substring(.,2),'\','\\'),'&quot;','\\\&quot;')"/>
833
+ <xsl:value-of select="str:replace(str:replace(substring(.,2),'\','\\'),'&quot;','\&quot;')"/>
834
834
  <xsl:text>")</xsl:text>
835
835
  </xsl:when>
836
836
  <xsl:otherwise>
837
- <xsl:value-of select="str:replace(str:replace(.,'\','\\'),'&quot;','\\\&quot;')"/>
837
+ <xsl:value-of select="str:replace(str:replace(.,'\','\\'),'&quot;','\&quot;')"/>
838
838
  </xsl:otherwise>
839
839
  </xsl:choose>
840
840
  <xsl:text>"</xsl:text>
@@ -864,11 +864,11 @@
864
864
  <xsl:choose>
865
865
  <xsl:when test="substring(.,1,1) = '!'">
866
866
  <xsl:text>>🠊("</xsl:text>
867
- <xsl:value-of select="str:replace(str:replace(substring(.,2),'\','\\'),'&quot;','\\\&quot;')"/>
867
+ <xsl:value-of select="str:replace(str:replace(substring(.,2),'\','\\'),'&quot;','\&quot;')"/>
868
868
  <xsl:text>")</xsl:text>
869
869
  </xsl:when>
870
870
  <xsl:otherwise>
871
- <xsl:value-of select="str:replace(str:replace(.,'\','\\'),'&quot;','\\\&quot;')"/>
871
+ <xsl:value-of select="str:replace(str:replace(.,'\','\\'),'&quot;','\&quot;')"/>
872
872
  </xsl:otherwise>
873
873
  </xsl:choose>
874
874
  <xsl:text>"</xsl:text>
@@ -892,11 +892,11 @@
892
892
  <xsl:choose>
893
893
  <xsl:when test="substring(.,1,1) = '!'">
894
894
  <xsl:text>>🠊("</xsl:text>
895
- <xsl:value-of select="str:replace(str:replace(substring(.,2),'\','\\'),'&quot;','\\\&quot;')"/>
895
+ <xsl:value-of select="str:replace(str:replace(substring(.,2),'\','\\'),'&quot;','\&quot;')"/>
896
896
  <xsl:text>")</xsl:text>
897
897
  </xsl:when>
898
898
  <xsl:otherwise>
899
- <xsl:value-of select="str:replace(str:replace(.,'\','\\'),'&quot;','\\\&quot;')"/>
899
+ <xsl:value-of select="str:replace(str:replace(.,'\','\\'),'&quot;','\&quot;')"/>
900
900
  </xsl:otherwise>
901
901
  </xsl:choose>
902
902
  <xsl:text>"</xsl:text>
@@ -19,11 +19,11 @@ module CPEE
19
19
  module Ruby
20
20
  BACKEND_INSTANCE = 'instance.rb'
21
21
  DSL_TO_DSLX_XSL = File.expand_path(File.join(__dir__,'dsl_to_dslx.xsl'))
22
- BACKEND_RUN = File.expand_path(File.join(__dir__,'backend','run'))
22
+ BACKEND_RUN = File.expand_path(File.join(__dir__,'backend','run.rb'))
23
23
  BACKEND_OPTS = File.expand_path(File.join(__dir__,'backend','opts.yaml'))
24
24
  BACKEND_TEMPLATE = File.expand_path(File.join(__dir__,'backend','instance.template'))
25
25
 
26
- def self::dslx_to_dsl(dslx) # transpile
26
+ def self::dslx_to_dsl(dslx,ep) # transpile
27
27
  trans = XML::Smart::open_unprotected(ExecutionHandler::Ruby::DSL_TO_DSLX_XSL)
28
28
  dslx.transform_with(trans).to_s
29
29
  end
@@ -0,0 +1 @@
1
+ 949873
@@ -0,0 +1 @@
1
+ 949891
@@ -0,0 +1 @@
1
+ 949885
@@ -0,0 +1 @@
1
+ 949879
@@ -36,6 +36,7 @@ Daemonite.new do |opts|
36
36
  opts[:events] = []
37
37
  0.upto(opts[:workers]-1) do |w|
38
38
  opts[:events] += [
39
+ 'event:' + ('%02i' % w) + ':transaction/start',
39
40
  'event:' + ('%02i' % w) + ':state/change',
40
41
  'event:' + ('%02i' % w) + ':executionhandler/change',
41
42
  'event:' + ('%02i' % w) + ':description/change',
@@ -107,6 +108,8 @@ Daemonite.new do |opts|
107
108
  end
108
109
  end
109
110
  end
111
+ when /event:(\d+):transaction\/start/
112
+ opts[:redis].publish('event:' + $1 + ':transaction/finished',message)
110
113
  when /event:\d+:transformation\/change/
111
114
  opts[:redis].multi do |multi|
112
115
  multi.set("instance:#{instance}/transformation/description",mess.dig('content','description'))
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.74
4
+ version: 2.1.77
5
5
  platform: ruby
6
6
  authors:
7
7
  - Juergen eTM Mangler
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: tools
12
12
  cert_chain: []
13
- date: 2024-12-06 00:00:00.000000000 Z
13
+ date: 2025-02-16 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: riddl
@@ -178,6 +178,26 @@ dependencies:
178
178
  - - ">="
179
179
  - !ruby/object:Gem::Version
180
180
  version: 1.0.4
181
+ - !ruby/object:Gem::Dependency
182
+ name: by
183
+ requirement: !ruby/object:Gem::Requirement
184
+ requirements:
185
+ - - "~>"
186
+ - !ruby/object:Gem::Version
187
+ version: '1.1'
188
+ - - ">="
189
+ - !ruby/object:Gem::Version
190
+ version: 1.1.0
191
+ type: :runtime
192
+ prerelease: false
193
+ version_requirements: !ruby/object:Gem::Requirement
194
+ requirements:
195
+ - - "~>"
196
+ - !ruby/object:Gem::Version
197
+ version: '1.1'
198
+ - - ">="
199
+ - !ruby/object:Gem::Version
200
+ version: 1.1.0
181
201
  description: see http://cpee.org
182
202
  email: juergen.mangler@gmail.com
183
203
  executables:
@@ -880,9 +900,11 @@ files:
880
900
  - lib/properties/properties.rng
881
901
  - lib/properties/set-properties.rng
882
902
  - lib/properties/set-some-properties.rng
903
+ - lib/properties/set-testset.rng
883
904
  - lib/properties/simple.rng
884
905
  - lib/properties/state.rng
885
906
  - lib/properties/status.rng
907
+ - lib/properties/subscriptions.rng
886
908
  - lib/properties/t_attributes.rng
887
909
  - lib/properties/t_dataelements.rng
888
910
  - lib/properties/t_endpoints.rng
@@ -904,7 +926,7 @@ files:
904
926
  - server/executionhandlers/ruby/backend/README.md
905
927
  - server/executionhandlers/ruby/backend/instance.template
906
928
  - server/executionhandlers/ruby/backend/opts.yaml
907
- - server/executionhandlers/ruby/backend/run
929
+ - server/executionhandlers/ruby/backend/run.rb
908
930
  - server/executionhandlers/ruby/connection.rb
909
931
  - server/executionhandlers/ruby/controller.rb
910
932
  - server/executionhandlers/ruby/dsl_to_dslx.xsl
@@ -917,9 +939,13 @@ files:
917
939
  - server/resources/states.xml
918
940
  - server/resources/topics.xml
919
941
  - server/resources/transformation.xml
942
+ - server/routing/end.pid
920
943
  - server/routing/end.rb
944
+ - server/routing/forward-events-00.pid
921
945
  - server/routing/forward-events.rb
946
+ - server/routing/forward-votes.pid
922
947
  - server/routing/forward-votes.rb
948
+ - server/routing/persist.pid
923
949
  - server/routing/persist.rb
924
950
  - server/server.pid
925
951
  - server/server.rb
@@ -946,7 +972,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
946
972
  - !ruby/object:Gem::Version
947
973
  version: '0'
948
974
  requirements: []
949
- rubygems_version: 3.5.16
975
+ rubygems_version: 3.5.22
950
976
  signing_key:
951
977
  specification_version: 4
952
978
  summary: The cloud process execution engine (cpee.org). If you just need workflow