weel 1.99.102 → 1.99.105

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9a13fce46d5710759c73bb36ca6899d31e4934d870e8b8106f4475886634a03a
4
- data.tar.gz: af4a5310b405e55029932cc977fbf45015c02be18aff50668b39a23ebcf567f7
3
+ metadata.gz: 36eb4b85ca61d7f3581ed326a038ded4e7efcebfb07df13f5d449d3e4b60784f
4
+ data.tar.gz: 655750bd2f7ba16c7951eb0d93c111f06788193120a445478108d16d6a9a35ac
5
5
  SHA512:
6
- metadata.gz: 34768aa9b9ec5c9d72d6e650ed59bdc8a37d5760532cebe63933739b6cff7bc0ff9ca1c3e322f6877821e6af14b2835793881a98c7d383083046e26847d5208b
7
- data.tar.gz: 81601be8fe0a73df8a34d436d8530a2376bd93553c1df70c1a5a5bfc54e84faf2714063545616a26598cc8d3b7e3e92386cca09619f1241169e9ceed19a848ea
6
+ metadata.gz: 1e60b5ea0829d5507f61599a917473eaa51b4fe5fb7f786c377ee8005a2fcf6ae295875729c634588815e1ad76f0fb46058b332b5a0b55528b7030f6d911b7e5
7
+ data.tar.gz: ae3b62411608b8725e734900520e7a42d99559852d131f24609699b72cdbbfa6f2d845ddcfa17c4a03a9bf3ab906da8911c36c71cdf0d27d40189f40c85c84f9
data/lib/weel.rb CHANGED
@@ -263,6 +263,48 @@ class WEEL
263
263
  end
264
264
  end # }}}
265
265
 
266
+ class ReadOnlyHash # {{{
267
+ def initialize(values,sim=false)
268
+ @__weel_values = values.transform_values do |v|
269
+ if Object.const_defined?(:XML) && XML.const_defined?(:Smart) && v.is_a?(XML::Smart::Dom)
270
+ v.root.to_doc
271
+ else
272
+ begin
273
+ Marshal.load(Marshal.dump(v))
274
+ rescue
275
+ v.to_s rescue nil
276
+ end
277
+ end
278
+ end
279
+ @__weel_sim = sim
280
+ end
281
+
282
+ def to_json(*args)
283
+ @__weel_values.to_json(*args)
284
+ end
285
+
286
+ def method_missing(name,*args)
287
+ if @__weel_sim
288
+ "➤#{name}"
289
+ else
290
+ if args.empty? && @__weel_values.key?(name)
291
+ @__weel_values[name]
292
+ elsif args.empty? && @__weel_values.key?(name.to_s)
293
+ @__weel_values[name.to_s]
294
+ elsif name.to_s[-1..-1] == "=" && args.length == 1
295
+ temp = name.to_s[0..-2]
296
+ @__weel_values[temp.to_sym] = args[0]
297
+ elsif name.to_s == "[]=" && args.length == 2
298
+ @__weel_values[args[0]] = args[1]
299
+ elsif name.to_s == "[]" && args.length == 1
300
+ @__weel_values[args[0]]
301
+ else
302
+ nil
303
+ end
304
+ end
305
+ end
306
+ end # }}}
307
+
266
308
  class ConnectionWrapperBase # {{{
267
309
  def self::loop_guard(arguments,lid,count); false; end
268
310
  def self::inform_state_change(arguments,newstate); end
@@ -304,7 +346,8 @@ class WEEL
304
346
  def mem_guard; end
305
347
 
306
348
  def test_condition(mr,code); mr.instance_eval(code); end
307
- def manipulate(mr,code,result=nil,options=nil); mr.instance_eval(code); end
349
+ def join_branches(branches); end
350
+ def manipulate(mr,code,where,result=nil,options=nil); mr.instance_eval(code,where,1); end
308
351
  end # }}}
309
352
 
310
353
  class Position # {{{
@@ -437,6 +480,8 @@ class WEEL
437
480
  return if self.__weel_state == :stopping || self.__weel_state == :finishing || self.__weel_state == :stopped
438
481
 
439
482
  Thread.current[:branches] = []
483
+ Thread.current[:branch_traces] = {}
484
+ Thread.current[:branch_traces_ids] = 0
440
485
  Thread.current[:branch_finished_count] = 0
441
486
  Thread.current[:branch_event] = Continue.new
442
487
  Thread.current[:mutex] = Mutex.new
@@ -465,6 +510,9 @@ class WEEL
465
510
 
466
511
  __weel_sim_stop(:parallel,hw,pos) if __weel_sim
467
512
 
513
+ cw = @__weel_connectionwrapper.new @__weel_connectionwrapper_args
514
+ cw.join_branches(Thread.current[:branch_traces])
515
+
468
516
  unless self.__weel_state == :stopping || self.__weel_state == :finishing || self.__weel_state == :stopped
469
517
  # first set all to no_longer_neccessary
470
518
  Thread.current[:branches].each do |thread|
@@ -496,6 +544,10 @@ class WEEL
496
544
  Thread.current[:branch_parent] = branch_parent
497
545
  Thread.current[:start_event] = Continue.new
498
546
  Thread.current[:branch_wait_count_cancel_active] = false
547
+ branch_parent[:mutex].synchronize do
548
+ Thread.current[:branch_traces_id] = branch_parent[:branch_traces_ids]
549
+ branch_parent[:branch_traces_ids] += 1
550
+ end
499
551
 
500
552
  if __weel_sim
501
553
  Thread.current[:branch_sim_pos] = @__weel_sim += 1
@@ -668,6 +720,13 @@ class WEEL
668
720
  searchmode = __weel_is_in_search_mode(position)
669
721
  return if searchmode
670
722
  return if self.__weel_state == :stopping || self.__weel_state == :finishing || self.__weel_state == :stopped || Thread.current[:nolongernecessary]
723
+
724
+ # gather traces in threads to point to join
725
+ if Thread.current[:branch_parent] && Thread.current[:branch_traces_id]
726
+ Thread.current[:branch_parent][:branch_traces][Thread.current[:branch_traces_id]] ||= []
727
+ Thread.current[:branch_parent][:branch_traces][Thread.current[:branch_traces_id]] << position
728
+ end
729
+
671
730
  __weel_progress position, true
672
731
  self.__weel_state = :stopping
673
732
  end #}}}
@@ -676,7 +735,7 @@ class WEEL
676
735
  @__weel_status
677
736
  end # }}}
678
737
  def data # {{{
679
- ReadHash.new(@__weel_data,__weel_sim)
738
+ ReadOnlyHash.new(@__weel_data,__weel_sim)
680
739
  end # }}}
681
740
  def endpoints # {{{
682
741
  ReadHash.new(@__weel_endpoints)
@@ -765,6 +824,12 @@ class WEEL
765
824
  return
766
825
  end
767
826
 
827
+ # gather traces in threads to point to join
828
+ if Thread.current[:branch_parent] && Thread.current[:branch_traces_id]
829
+ Thread.current[:branch_parent][:branch_traces][Thread.current[:branch_traces_id]] ||= []
830
+ Thread.current[:branch_parent][:branch_traces][Thread.current[:branch_traces_id]] << position
831
+ end
832
+
768
833
  wp = __weel_progress position
769
834
 
770
835
  # searchmode position is after, jump directly to vote_sync_after
@@ -783,7 +848,7 @@ class WEEL
783
848
  mr.instance_eval(&finalize)
784
849
  elsif finalize.is_a?(String)
785
850
  mr = ManipulateStructure.new(@__weel_data,@__weel_endpoints,@__weel_status,connectionwrapper.additional)
786
- connectionwrapper.manipulate(mr,finalize)
851
+ connectionwrapper.manipulate(mr,finalize,'Activity ' + position.to_s)
787
852
  end
788
853
  connectionwrapper.inform_manipulate_change(
789
854
  ((mr && mr.changed_status) ? @__weel_status : nil),
@@ -805,7 +870,7 @@ class WEEL
805
870
  if prepare.is_a?(Proc)
806
871
  rs.instance_exec(&prepare)
807
872
  elsif prepare.is_a?(String)
808
- rs.instance_eval prepare
873
+ connectionwrapper.manipulate(rs,prepare,'Activity ' + position.to_s)
809
874
  end
810
875
  end
811
876
  params = connectionwrapper.prepare(rs,endpoint,parameters,@__weel_replay)
@@ -857,7 +922,7 @@ class WEEL
857
922
  elsif code.is_a?(String)
858
923
  mr = ManipulateStructure.new(@__weel_data,@__weel_endpoints,@__weel_status,connectionwrapper.additional)
859
924
  ma = catch Signal::Again do
860
- connectionwrapper.manipulate(mr,code,connectionwrapper.activity_result_value,connectionwrapper.activity_result_options)
925
+ connectionwrapper.manipulate(mr,code,'Activity ' + position.to_s,connectionwrapper.activity_result_value,connectionwrapper.activity_result_options)
861
926
  'yes' # ma sadly will have nil when i just throw
862
927
  end
863
928
  end
@@ -106,11 +106,4 @@ class TestConnectionWrapper < WEEL::ConnectionWrapperBase
106
106
  $short_track << "F#{@__myhandler_position}"
107
107
  raise(err)
108
108
  end #}}}
109
-
110
- def manipulate(mr,code,result=nil,status=nil)
111
- mr.instance_eval(code)
112
- end
113
- def test_condition(mr,code)
114
- mr.instance_eval(code)
115
- end
116
109
  end
data/weel.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "weel"
3
- s.version = "1.99.102"
3
+ s.version = "1.99.105"
4
4
  s.platform = Gem::Platform::RUBY
5
5
  s.license = "LGPL-3.0"
6
6
  s.summary = "Workflow Execution Engine Library (WEEL)"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: weel
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.99.102
4
+ version: 1.99.105
5
5
  platform: ruby
6
6
  authors:
7
7
  - Juergen eTM Mangler
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2022-08-01 00:00:00.000000000 Z
12
+ date: 2023-02-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: test-unit
@@ -101,7 +101,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
101
101
  - !ruby/object:Gem::Version
102
102
  version: '0'
103
103
  requirements: []
104
- rubygems_version: 3.3.7
104
+ rubygems_version: 3.3.26
105
105
  signing_key:
106
106
  specification_version: 4
107
107
  summary: Workflow Execution Engine Library (WEEL)