weel 1.99.147 → 1.99.149

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 (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/weel.rb +29 -38
  3. data/weel.gemspec +1 -1
  4. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 69f09565a0379192ad8313bef74a41fa04c5b088f8d8422aa2f74608e9ff7f8e
4
- data.tar.gz: 7981eaa92f35eb497354db544616596daff1d31343abd87a2ea313d5db33e6ad
3
+ metadata.gz: 75f93b76bf6a052ab4599ab858f7fe6af5ffcb694c09a4d37a334dbafe7f2382
4
+ data.tar.gz: 59c5301f495c1d6ab3ee162b7dfcdd62e1cffc8224b2215d0591668e67045af8
5
5
  SHA512:
6
- metadata.gz: 015f753c35aab1d566cf8e8d4225776380f5ac52038e1f5cc77affebb30202c4d121bdd5b64e987ee78672f8e5aeb85b74ca36328f96ec8e1db8658797f41412
7
- data.tar.gz: 5c91f64464d1b0dd98a8725017f5eba90319f042c6bcfe73b5fa8711e728d00163e458e72cb80ccba1dc6dd1ed48b450b4cf387e0215984522470dd3c4def355
6
+ metadata.gz: b67b945afbda1ea61fa806746768fe43d9dc92eb15749690cfb98a019e49d284a3edcce595d45d96f44569210c26f93a92023ed26bbbad9d0d7e893b053788de
7
+ data.tar.gz: eeebb997bbeb33b2304db64c84ca2e29a5dc478e70bbccdb3539eacc4e185fbd8f50addcc051285be41d17867730c44fa574338c93b49b72117013226f24b26c
data/lib/weel.rb CHANGED
@@ -374,7 +374,7 @@ class WEEL
374
374
  def mem_guard; end
375
375
 
376
376
  def prepare(lock,dataelements,endpoints,status,local,additional,code,exec_endpoints,exec_parameters); end
377
- def test_condition(dataelements,endpoints,local,additional,code,args={}); ReadStructure.new(dataelements,endpoints,local,additional).instance_eval(code); end
377
+ def test_condition(eid,dataelements,endpoints,local,additional,code,args={}); ReadStructure.new(dataelements,endpoints,local,additional).instance_eval(code); end
378
378
  def manipulate(readonly,lock,dataelements,endpoints,status,local,additional,code,where,result=nil,options=nil)
379
379
  lock.synchronize do
380
380
  if readonly
@@ -385,8 +385,8 @@ class WEEL
385
385
  end
386
386
  end
387
387
 
388
- def join_branches(id,branches=[]); end
389
- def split_branches(id,branches=[]); end
388
+ def join_branches(eid,branches=[]); end
389
+ def split_branches(eid,branches=[]); end
390
390
  end # }}}
391
391
 
392
392
  class Position # {{{
@@ -490,11 +490,12 @@ class WEEL
490
490
  @__weel_connectionwrapper_args = []
491
491
  @__weel_state = :ready
492
492
  @__weel_status = Status.new(0,"undefined")
493
- @__weel_sim = false
493
+ @__weel_abandon = false
494
494
  @__weel_lock = Mutex.new
495
495
  end #}}}
496
496
  attr_accessor :__weel_search_positions, :__weel_positions, :__weel_main, :__weel_data, :__weel_endpoints, :__weel_connectionwrapper, :__weel_connectionwrapper_args
497
497
  attr_reader :__weel_state, :__weel_status, :__weel_status
498
+ def __weel_abandon? = @__weel_abandon
498
499
 
499
500
  # DSL-Construct for translating expressions into static parameters
500
501
  def 🠊(code); ProcString.new(code); end
@@ -519,7 +520,7 @@ class WEEL
519
520
  # Parallel DSL-Construct
520
521
  # Defines Workflow paths that can be executed parallel.
521
522
  # May contain multiple branches (parallel_branch)
522
- def parallel(type=nil,&block)# {{{
523
+ def parallel(eid,type=nil,&block)# {{{
523
524
  return if self.__weel_state == :stopping || self.__weel_state == :finishing || self.__weel_state == :stopped || Thread.current[:nolongernecessary]
524
525
 
525
526
  Thread.current[:branches] = []
@@ -540,7 +541,7 @@ class WEEL
540
541
  end
541
542
 
542
543
  cw = @__weel_connectionwrapper.new @__weel_connectionwrapper_args
543
- cw.split_branches Thread.current.__id__, Thread.current[:branch_traces]
544
+ cw.split_branches eid, Thread.current[:branch_traces]
544
545
 
545
546
  Thread.current[:branches].each do |thread|
546
547
  # decide after executing block in parallel cause for coopis
@@ -553,7 +554,7 @@ class WEEL
553
554
 
554
555
  Thread.current[:branch_event].wait unless self.__weel_state == :stopping || self.__weel_state == :finishing || self.__weel_state == :stopped || Thread.current[:branches].length == 0
555
556
 
556
- cw.join_branches Thread.current.__id__, Thread.current[:branch_traces]
557
+ cw.join_branches eid, Thread.current[:branch_traces]
557
558
 
558
559
  unless self.__weel_state == :stopping || self.__weel_state == :finishing || self.__weel_state == :stopped
559
560
  # first set all to no_longer_neccessary, just in case, but this should not be necessary
@@ -569,7 +570,7 @@ class WEEL
569
570
  end # }}}
570
571
 
571
572
  # Defines a branch of a parallel-Construct
572
- def parallel_branch(data=@__weel_data,&block)# {{
573
+ def parallel_branch(eid,data=@__weel_data,&block) #{{{
573
574
  return if self.__weel_state == :stopping || self.__weel_state == :finishing || self.__weel_state == :stopped || Thread.current[:nolongernecessary]
574
575
  branch_parent = Thread.current
575
576
 
@@ -631,12 +632,12 @@ class WEEL
631
632
  end
632
633
  end
633
634
  end
634
- end # }}}
635
+ end #}}}
635
636
 
636
637
  # Choose DSL-Construct
637
638
  # Defines a choice in the Workflow path.
638
639
  # May contain multiple execution alternatives
639
- def choose(mode=:inclusive,&block) # {{{
640
+ def choose(eid,mode=:inclusive,&block) # {{{
640
641
  return if self.__weel_state == :stopping || self.__weel_state == :finishing || self.__weel_state == :stopped || Thread.current[:nolongernecessary]
641
642
  Thread.current[:alternative_executed] ||= []
642
643
  Thread.current[:alternative_mode] ||= []
@@ -645,9 +646,9 @@ class WEEL
645
646
 
646
647
  cw = @__weel_connectionwrapper.new @__weel_connectionwrapper_args
647
648
 
648
- cw.split_branches Thread.current.__id__
649
+ cw.split_branches eid
649
650
  __weel_protect_yield(&block)
650
- cw.join_branches Thread.current.__id__
651
+ cw.join_branches eid
651
652
 
652
653
  Thread.current[:alternative_executed].pop
653
654
  Thread.current[:alternative_mode].pop
@@ -657,13 +658,13 @@ class WEEL
657
658
  # Defines a possible choice of a choose-Construct
658
659
  # Block is executed if condition == true or
659
660
  # searchmode is active (to find the starting position)
660
- def alternative(condition,args={},&block)# {{{
661
+ def alternative(eid,condition,args={},&block)# {{{
661
662
  return if self.__weel_state == :stopping || self.__weel_state == :finishing || self.__weel_state == :stopped || Thread.current[:nolongernecessary]
662
663
  Thread.current[:mutex] ||= Mutex.new
663
664
  Thread.current[:mutex].synchronize do
664
665
  return if Thread.current[:alternative_mode][-1] == :exclusive && Thread.current[:alternative_executed][-1] == true
665
666
  if condition.is_a?(String)
666
- condition = __weel_eval_condition(condition, args)
667
+ condition = __weel_eval_condition(eid, condition, args)
667
668
  end
668
669
  Thread.current[:alternative_executed][-1] = true if condition
669
670
  end
@@ -671,7 +672,7 @@ class WEEL
671
672
  __weel_protect_yield(&block) if searchmode || condition
672
673
  Thread.current[:alternative_executed][-1] = true if __weel_is_in_search_mode != searchmode # we swiched from searchmode true to false, thus branch has been executed which is as good as evaling the condition to true
673
674
  end # }}}
674
- def otherwise(args={},&block) # {{{
675
+ def otherwise(eid,args={},&block) # {{{
675
676
  return if self.__weel_state == :stopping || self.__weel_state == :finishing || self.__weel_state == :stopped || Thread.current[:nolongernecessary]
676
677
  __weel_protect_yield(&block) if __weel_is_in_search_mode || !Thread.current[:alternative_executed].last
677
678
  end # }}}
@@ -709,7 +710,7 @@ class WEEL
709
710
  end #}}}
710
711
 
711
712
  # Defines a critical block (=Mutex)
712
- def critical(id,&block)# {{{
713
+ def critical(eid,id,&block)# {{{
713
714
  return if self.__weel_state == :stopping || self.__weel_state == :finishing || self.__weel_state == :stopped || Thread.current[:nolongernecessary]
714
715
  @__weel_critical ||= Mutex.new
715
716
  semaphore = nil
@@ -724,7 +725,7 @@ class WEEL
724
725
  end # }}}
725
726
 
726
727
  # Defines a Cycle (loop/iteration)
727
- def loop(condition,args={},&block)# {{{
728
+ def loop(eid,condition,args={},&block)# {{{
728
729
  unless condition[0].is_a?(String) && [:pre_test,:post_test].include?(condition[1]) && args.is_a?(Hash)
729
730
  raise "condition must be called pre_test{} or post_test{}"
730
731
  end
@@ -746,7 +747,7 @@ class WEEL
746
747
  catch :escape do
747
748
  case condition[1]
748
749
  when :pre_test
749
- while __weel_eval_condition(condition[0],args) && self.__weel_state != :stopping && self.__weel_state != :stopped && self.__weel_state != :finishing && !Thread.current[:nolongernecessary]
750
+ while __weel_eval_condition(eid, condition[0],args) && self.__weel_state != :stopping && self.__weel_state != :stopped && self.__weel_state != :finishing && !Thread.current[:nolongernecessary]
750
751
  loop_guard += 1
751
752
  __weel_protect_yield(&block)
752
753
  sleep 1 if @__weel_connectionwrapper::loop_guard(@__weel_connectionwrapper_args,loop_id,loop_guard)
@@ -756,7 +757,7 @@ class WEEL
756
757
  loop_guard += 1
757
758
  __weel_protect_yield(&block)
758
759
  sleep 1 if @__weel_connectionwrapper::loop_guard(@__weel_connectionwrapper_args,loop_id,loop_guard)
759
- end while __weel_eval_condition(condition[0],args) && self.__weel_state != :stopping && self.__weel_state != :stopped && self.__weel_state != :finishing && !Thread.current[:nolongernecessary]
760
+ end while __weel_eval_condition(eid, condition[0],args) && self.__weel_state != :stopping && self.__weel_state != :stopped && self.__weel_state != :finishing && !Thread.current[:nolongernecessary]
760
761
  end
761
762
  end
762
763
  end # }}}
@@ -771,14 +772,15 @@ class WEEL
771
772
  [code || blk, :post_test]
772
773
  end # }}}
773
774
 
774
- def escape #{{{
775
+ def escape(eid) #{{{
775
776
  return if __weel_is_in_search_mode
776
777
  return if self.__weel_state == :stopping || self.__weel_state == :finishing || self.__weel_state == :stopped || Thread.current[:nolongernecessary]
777
778
  throw :escape
778
779
  end #}}}
779
- def terminate #{{{
780
+ def terminate(eid,abandon=false) #{{{
780
781
  return if __weel_is_in_search_mode
781
782
  return if self.__weel_state == :stopping || self.__weel_state == :finishing || self.__weel_state == :stopped || Thread.current[:nolongernecessary]
783
+ @__weel_abandon = abandon
782
784
  self.__weel_state = :finishing
783
785
  end #}}}
784
786
  def stop(position) #{{{
@@ -816,10 +818,10 @@ class WEEL
816
818
  end
817
819
  end #}}}
818
820
 
819
- def __weel_eval_condition(condition,args={}) #{{{
821
+ def __weel_eval_condition(eid,condition,args={}) #{{{
820
822
  begin
821
823
  connectionwrapper = @__weel_connectionwrapper.new @__weel_connectionwrapper_args
822
- connectionwrapper.test_condition(@__weel_data,@__weel_endpoints,Thread.current[:local],connectionwrapper.additional,condition,args)
824
+ connectionwrapper.test_condition(eid,@__weel_data,@__weel_endpoints,Thread.current[:local],connectionwrapper.additional,condition,args)
823
825
  rescue NameError => err # don't look into it, or it will explode
824
826
  self.__weel_state = :stopping
825
827
  @__weel_connectionwrapper::inform_syntax_error(@__weel_connectionwrapper_args,Exception.new("protect_yield: `#{err.name}` is not a thing that can be used. Maybe it is meant to be a string and you forgot quotes?"),nil)
@@ -1128,11 +1130,11 @@ class WEEL
1128
1130
  @__weel_positions = Array.new if newState == :running
1129
1131
  @__weel_state = newState
1130
1132
 
1133
+ @__weel_connectionwrapper::inform_state_change @__weel_connectionwrapper_args, @__weel_state
1134
+
1131
1135
  if newState == :stopping || newState == :finishing
1132
1136
  __weel_recursive_continue(@__weel_main)
1133
1137
  end
1134
-
1135
- @__weel_connectionwrapper::inform_state_change @__weel_connectionwrapper_args, @__weel_state
1136
1138
  end # }}}
1137
1139
 
1138
1140
  end # }}}
@@ -1167,7 +1169,7 @@ public
1167
1169
  nil
1168
1170
  end # }}}
1169
1171
 
1170
- # Get the state of execution (ready|running|stopping|stopped|finished|simulating|abandoned)
1172
+ # Get the state of execution (ready|running|stopping|stopped|finished|abandoned)
1171
1173
  def state # {{{
1172
1174
  @dslr.__weel_state
1173
1175
  end # }}}
@@ -1211,9 +1213,7 @@ public
1211
1213
  @dslr.__weel_positions.clear
1212
1214
  @dslr.__weel_connectionwrapper::inform_position_change(@dslr.__weel_connectionwrapper_args,ipc)
1213
1215
  @dslr.__weel_state = :finished
1214
- end
1215
- if @dslr.__weel_state == :simulating
1216
- @dslr.__weel_state = final_state
1216
+ @dslr.__weel_state = :abandoned if @dslr.__weel_abandon?
1217
1217
  end
1218
1218
  if @dslr.__weel_state == :stopping
1219
1219
  @dslr.__weel_finalize
@@ -1286,13 +1286,4 @@ public
1286
1286
  end
1287
1287
  end
1288
1288
  end # }}}
1289
-
1290
- def sim # {{{
1291
- stat = @dslr.__weel_state
1292
- return nil unless stat == :ready || stat == :stopped
1293
- @dslr.__weel_main = Thread.new do
1294
- __weel_control_flow :simulating, stat
1295
- end
1296
- end # }}}
1297
-
1298
1289
  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.147"
3
+ s.version = "1.99.149"
4
4
  s.platform = Gem::Platform::RUBY
5
5
  s.license = "LGPL-3.0-or-later"
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.147
4
+ version: 1.99.149
5
5
  platform: ruby
6
6
  authors:
7
7
  - Juergen eTM Mangler