weel 1.99.98 → 1.99.101
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 +4 -4
- data/lib/weel.rb +98 -94
- data/test/{SimHandlerWrapper.rb → SimConnectionWrapper.rb} +18 -18
- data/test/{TestHandlerWrapper.rb → TestConnectionWrapper.rb} +2 -2
- data/test/TestWorkflow.rb +2 -2
- data/test/basic/tc_handler.rb +4 -4
- data/weel.gemspec +1 -1
- metadata +35 -35
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 030dcffc555d0badc6c5c4a22538562c6a2f893b08dbccd48b7b9c5553810e10
|
|
4
|
+
data.tar.gz: f368fadc1a33b23e20216f01f329a28faac6dacdb32b928186aa3b4e18a636e4
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c2eb9d5daca03086f6b2029fe20a334fab264b1f145b91261027ff7bd6e546c77611709721a074d0e3f7348b48558fa144228fe85f97f9cf3b50010035058451
|
|
7
|
+
data.tar.gz: 28d6afad61ba96bbf89b23cbfe0c7ddfb276c25abc05ef280b6d6a1a5c93448a6edff9bcc6be68aeba9ee4ead0db7345cb681b07ced26e3ca84930b0a73bcfa2
|
data/lib/weel.rb
CHANGED
|
@@ -20,13 +20,14 @@ require 'securerandom'
|
|
|
20
20
|
class WEEL
|
|
21
21
|
def initialize(*args)# {{{
|
|
22
22
|
@dslr = DSLRealization.new
|
|
23
|
-
@dslr.
|
|
23
|
+
@dslr.__weel_connectionwrapper_args = args
|
|
24
24
|
|
|
25
25
|
initialize_search if methods.include?(:initialize_search)
|
|
26
26
|
initialize_data if methods.include?(:initialize_data)
|
|
27
27
|
initialize_endpoints if methods.include?(:initialize_endpoints)
|
|
28
|
-
|
|
28
|
+
initialize_connectionwrapper if methods.include?(:initialize_connectionwrapper)
|
|
29
29
|
initialize_control if methods.include?(:initialize_control)
|
|
30
|
+
initialize_flow_data if methods.include?(:initialize_flow_data)
|
|
30
31
|
end # }}}
|
|
31
32
|
|
|
32
33
|
module Signal # {{{
|
|
@@ -196,8 +197,9 @@ class WEEL
|
|
|
196
197
|
@message = message
|
|
197
198
|
end
|
|
198
199
|
def nudge!
|
|
199
|
-
@nudge.
|
|
200
|
-
|
|
200
|
+
1.upto(@nudge.num_waiting) do
|
|
201
|
+
@nudge.push(nil)
|
|
202
|
+
end
|
|
201
203
|
end
|
|
202
204
|
def wait_until_nudged!
|
|
203
205
|
@nudge.pop
|
|
@@ -237,11 +239,11 @@ class WEEL
|
|
|
237
239
|
end
|
|
238
240
|
end # }}}
|
|
239
241
|
|
|
240
|
-
class
|
|
242
|
+
class ConnectionWrapperBase # {{{
|
|
241
243
|
def self::loop_guard(arguments,lid,count); false; end
|
|
242
244
|
def self::inform_state_change(arguments,newstate); end
|
|
243
245
|
def self::inform_syntax_error(arguments,err,code); end
|
|
244
|
-
def self::
|
|
246
|
+
def self::inform_connectionwrapper_error(arguments,err); end
|
|
245
247
|
def self::inform_position_change(arguments,ipc={}); end
|
|
246
248
|
|
|
247
249
|
def initialize(arguments,position=nil,continue=nil); end
|
|
@@ -353,19 +355,21 @@ class WEEL
|
|
|
353
355
|
end
|
|
354
356
|
end
|
|
355
357
|
end # }}}
|
|
356
|
-
def self::
|
|
357
|
-
define_method :
|
|
358
|
-
self.
|
|
359
|
-
self.
|
|
358
|
+
def self::connectionwrapper(aClassname, *args)# {{{
|
|
359
|
+
define_method :initialize_connectionwrapper do
|
|
360
|
+
self.connectionwrapper = aClassname
|
|
361
|
+
self.connectionwrapper_args = args unless args.empty?
|
|
360
362
|
end
|
|
361
363
|
end # }}}
|
|
362
364
|
def self::control(flow, &block)# {{{
|
|
363
|
-
@@__weel_control_block = block
|
|
364
365
|
define_method :initialize_control do
|
|
365
|
-
self.description =
|
|
366
|
+
self.description = block
|
|
366
367
|
end
|
|
367
368
|
end # }}}
|
|
368
|
-
def self::flow # {{{
|
|
369
|
+
def self::flow(flow_data=nil) # {{{
|
|
370
|
+
define_method :initialize_flow_data do
|
|
371
|
+
self.flow_data = flow_data
|
|
372
|
+
end if flow_data
|
|
369
373
|
end #}}}
|
|
370
374
|
|
|
371
375
|
class DSLRealization # {{{
|
|
@@ -375,14 +379,14 @@ class WEEL
|
|
|
375
379
|
@__weel_main = nil
|
|
376
380
|
@__weel_data ||= Hash.new
|
|
377
381
|
@__weel_endpoints ||= Hash.new
|
|
378
|
-
@
|
|
379
|
-
@
|
|
382
|
+
@__weel_connectionwrapper = ConnectionWrapperBase
|
|
383
|
+
@__weel_connectionwrapper_args = []
|
|
380
384
|
@__weel_state = :ready
|
|
381
385
|
@__weel_status = Status.new(0,"undefined")
|
|
382
386
|
@__weel_replay = false
|
|
383
387
|
@__weel_sim = -1
|
|
384
388
|
end #}}}
|
|
385
|
-
attr_accessor :__weel_search_positions, :__weel_positions, :__weel_main, :__weel_data, :__weel_endpoints, :
|
|
389
|
+
attr_accessor :__weel_search_positions, :__weel_positions, :__weel_main, :__weel_data, :__weel_endpoints, :__weel_connectionwrapper, :__weel_connectionwrapper_args, :__weel_replay
|
|
386
390
|
attr_reader :__weel_state, :__weel_status
|
|
387
391
|
|
|
388
392
|
# DSL-Constructs for atomic calls to external services (calls) and pure context manipulations (manipulate).
|
|
@@ -483,15 +487,15 @@ class WEEL
|
|
|
483
487
|
Thread.current[:start_event].wait unless self.__weel_state == :stopping || self.__weel_state == :stopped || self.__weel_state == :finishing
|
|
484
488
|
|
|
485
489
|
if __weel_sim
|
|
486
|
-
|
|
487
|
-
|
|
490
|
+
connectionwrapper = @__weel_connectionwrapper.new @__weel_connectionwrapper_args
|
|
491
|
+
connectionwrapper.simulate(:parallel_branch,:start,Thread.current[:branch_sim_pos],current_branch_sim_pos)
|
|
488
492
|
end
|
|
489
493
|
|
|
490
494
|
unless self.__weel_state == :stopping || self.__weel_state == :finishing || self.__weel_state == :stopped || Thread.current[:nolongernecessary]
|
|
491
495
|
__weel_protect_yield(*local, &block)
|
|
492
496
|
end
|
|
493
497
|
|
|
494
|
-
__weel_sim_stop(:parallel_branch,
|
|
498
|
+
__weel_sim_stop(:parallel_branch,connectionwrapper,current_branch_sim_pos) if __weel_sim
|
|
495
499
|
|
|
496
500
|
branch_parent[:mutex].synchronize do
|
|
497
501
|
Thread.current[:branch_status] = true
|
|
@@ -506,7 +510,7 @@ class WEEL
|
|
|
506
510
|
begin
|
|
507
511
|
ipc = {}
|
|
508
512
|
ipc[:unmark] = [Thread.current[:branch_position]]
|
|
509
|
-
@
|
|
513
|
+
@__weel_connectionwrapper::inform_position_change(@__weel_connectionwrapper_args,ipc)
|
|
510
514
|
end rescue nil
|
|
511
515
|
Thread.current[:branch_position] = nil
|
|
512
516
|
end
|
|
@@ -601,17 +605,17 @@ class WEEL
|
|
|
601
605
|
catch :escape do
|
|
602
606
|
case condition[1]
|
|
603
607
|
when :pre_test
|
|
604
|
-
while __weel_eval_condition(condition[0]) && self.__weel_state != :stopping && self.__weel_state != :stopped && self.__weel_state != :finishing
|
|
608
|
+
while __weel_eval_condition(condition[0]) && self.__weel_state != :stopping && self.__weel_state != :stopped && self.__weel_state != :finishing && !Thread.current[:nolongernecessary]
|
|
605
609
|
loop_guard += 1
|
|
606
610
|
__weel_protect_yield(&block)
|
|
607
|
-
sleep 1 if @
|
|
611
|
+
sleep 1 if @__weel_connectionwrapper::loop_guard(@__weel_connectionwrapper_args,loop_id,loop_guard)
|
|
608
612
|
end
|
|
609
613
|
when :post_test
|
|
610
614
|
begin
|
|
611
615
|
loop_guard += 1
|
|
612
616
|
__weel_protect_yield(&block)
|
|
613
|
-
sleep 1 if @
|
|
614
|
-
end while __weel_eval_condition(condition[0]) && self.__weel_state != :stopping && self.__weel_state != :stopped && self.__weel_state != :finishing
|
|
617
|
+
sleep 1 if @__weel_connectionwrapper::loop_guard(@__weel_connectionwrapper_args,loop_id,loop_guard)
|
|
618
|
+
end while __weel_eval_condition(condition[0]) && self.__weel_state != :stopping && self.__weel_state != :stopped && self.__weel_state != :finishing && !Thread.current[:nolongernecessary]
|
|
615
619
|
end
|
|
616
620
|
end
|
|
617
621
|
end # }}}
|
|
@@ -660,27 +664,27 @@ class WEEL
|
|
|
660
664
|
yield(*local) if block_given?
|
|
661
665
|
rescue NameError => err # don't look into it, or it will explode
|
|
662
666
|
self.__weel_state = :stopping
|
|
663
|
-
@
|
|
667
|
+
@__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)
|
|
664
668
|
nil
|
|
665
669
|
rescue => err
|
|
666
670
|
self.__weel_state = :stopping
|
|
667
|
-
@
|
|
671
|
+
@__weel_connectionwrapper::inform_syntax_error(@__weel_connectionwrapper_args,Exception.new(err.message),nil)
|
|
668
672
|
nil
|
|
669
673
|
end
|
|
670
674
|
end #}}}
|
|
671
675
|
|
|
672
676
|
def __weel_eval_condition(condition) #{{{
|
|
673
677
|
begin
|
|
674
|
-
|
|
675
|
-
condition.is_a?(Proc) ? condition.call :
|
|
678
|
+
connectionwrapper = @__weel_connectionwrapper.new @__weel_connectionwrapper_args unless condition.is_a?(Proc)
|
|
679
|
+
condition.is_a?(Proc) ? condition.call : connectionwrapper.test_condition(ReadStructure.new(@__weel_data,@__weel_endpoints,connectionwrapper.additional),condition)
|
|
676
680
|
rescue NameError => err # don't look into it, or it will explode
|
|
677
681
|
# if you access $! here, BOOOM
|
|
678
682
|
self.__weel_state = :stopping
|
|
679
|
-
@
|
|
683
|
+
@__weel_connectionwrapper::inform_syntax_error(@__weel_connectionwrapper_args,Exception.new("eval_condition: `#{err.name}` is not a thing that can be used. Maybe it is meant to be a string and you forgot quotes?"),nil)
|
|
680
684
|
nil
|
|
681
685
|
rescue => err
|
|
682
686
|
self.__weel_state = :stopping
|
|
683
|
-
@
|
|
687
|
+
@__weel_connectionwrapper::inform_syntax_error(@__weel_connectionwrapper_args,Exception.new(err.message),nil)
|
|
684
688
|
nil
|
|
685
689
|
end
|
|
686
690
|
end #}}}
|
|
@@ -718,7 +722,7 @@ class WEEL
|
|
|
718
722
|
@__weel_positions << wp
|
|
719
723
|
Thread.current[:branch_position] = wp
|
|
720
724
|
|
|
721
|
-
@
|
|
725
|
+
@__weel_connectionwrapper::inform_position_change @__weel_connectionwrapper_args, ipc
|
|
722
726
|
wp
|
|
723
727
|
end #}}}
|
|
724
728
|
|
|
@@ -730,10 +734,10 @@ class WEEL
|
|
|
730
734
|
return if self.__weel_state == :stopping || self.__weel_state == :finishing || self.__weel_state == :stopped || Thread.current[:nolongernecessary]
|
|
731
735
|
|
|
732
736
|
Thread.current[:continue] = Continue.new
|
|
733
|
-
|
|
737
|
+
connectionwrapper = @__weel_connectionwrapper.new @__weel_connectionwrapper_args, position, Thread.current[:continue]
|
|
734
738
|
|
|
735
739
|
if __weel_sim
|
|
736
|
-
|
|
740
|
+
connectionwrapper.simulate(:activity,:none,@__weel_sim += 1,Thread.current[:branch_sim_pos],:position => position,:parameters => parameters,:endpoint => endpoint,:type => type,:finalize => finalize.is_a?(String) ? finalize : nil)
|
|
737
741
|
return
|
|
738
742
|
end
|
|
739
743
|
|
|
@@ -744,35 +748,35 @@ class WEEL
|
|
|
744
748
|
|
|
745
749
|
case type
|
|
746
750
|
when :manipulate
|
|
747
|
-
raise Signal::Stop unless
|
|
751
|
+
raise Signal::Stop unless connectionwrapper.vote_sync_before
|
|
748
752
|
raise Signal::Skip if self.__weel_state == :stopping || self.__weel_state == :finishing
|
|
749
753
|
|
|
750
754
|
if finalize.is_a?(Proc) || finalize.is_a?(String)
|
|
751
|
-
|
|
752
|
-
|
|
755
|
+
connectionwrapper.activity_manipulate_handle(parameters)
|
|
756
|
+
connectionwrapper.inform_activity_manipulate
|
|
753
757
|
if finalize.is_a?(Proc)
|
|
754
|
-
mr = ManipulateStructure.new(@__weel_data,@__weel_endpoints,@__weel_status,
|
|
758
|
+
mr = ManipulateStructure.new(@__weel_data,@__weel_endpoints,@__weel_status,connectionwrapper.additional)
|
|
755
759
|
mr.instance_eval(&finalize)
|
|
756
760
|
elsif finalize.is_a?(String)
|
|
757
|
-
mr = ManipulateStructure.new(@__weel_data,@__weel_endpoints,@__weel_status,
|
|
758
|
-
|
|
761
|
+
mr = ManipulateStructure.new(@__weel_data,@__weel_endpoints,@__weel_status,connectionwrapper.additional)
|
|
762
|
+
connectionwrapper.manipulate(mr,finalize)
|
|
759
763
|
end
|
|
760
|
-
|
|
764
|
+
connectionwrapper.inform_manipulate_change(
|
|
761
765
|
((mr && mr.changed_status) ? @__weel_status : nil),
|
|
762
766
|
((mr && mr.changed_data.any?) ? mr.changed_data.uniq : nil),
|
|
763
767
|
((mr && mr.changed_endpoints.any?) ? mr.changed_endpoints.uniq : nil),
|
|
764
768
|
@__weel_data,
|
|
765
769
|
@__weel_endpoints
|
|
766
770
|
)
|
|
767
|
-
|
|
771
|
+
connectionwrapper.inform_activity_done
|
|
768
772
|
wp.detail = :after
|
|
769
|
-
@
|
|
773
|
+
@__weel_connectionwrapper::inform_position_change @__weel_connectionwrapper_args, :after => [wp]
|
|
770
774
|
end
|
|
771
775
|
when :call
|
|
772
776
|
begin
|
|
773
777
|
again = catch Signal::Again do
|
|
774
|
-
|
|
775
|
-
rs = ReadStructure.new(@__weel_data,@__weel_endpoints,
|
|
778
|
+
connectionwrapper.mem_guard
|
|
779
|
+
rs = ReadStructure.new(@__weel_data,@__weel_endpoints,connectionwrapper.additional)
|
|
776
780
|
if prepare
|
|
777
781
|
if prepare.is_a?(Proc)
|
|
778
782
|
rs.instance_exec(&prepare)
|
|
@@ -780,14 +784,14 @@ class WEEL
|
|
|
780
784
|
rs.instance_eval prepare
|
|
781
785
|
end
|
|
782
786
|
end
|
|
783
|
-
params =
|
|
784
|
-
raise Signal::Stop unless
|
|
787
|
+
params = connectionwrapper.prepare(rs,endpoint,parameters,@__weel_replay)
|
|
788
|
+
raise Signal::Stop unless connectionwrapper.vote_sync_before(params)
|
|
785
789
|
raise Signal::Skip if self.__weel_state == :stopping || self.__weel_state == :finishing
|
|
786
790
|
|
|
787
|
-
|
|
788
|
-
wp.passthrough =
|
|
791
|
+
connectionwrapper.activity_handle wp.passthrough, params
|
|
792
|
+
wp.passthrough = connectionwrapper.activity_passthrough_value
|
|
789
793
|
unless wp.passthrough.nil?
|
|
790
|
-
@
|
|
794
|
+
@__weel_connectionwrapper::inform_position_change @__weel_connectionwrapper_args, :wait => [wp]
|
|
791
795
|
end
|
|
792
796
|
begin
|
|
793
797
|
# with loop if catching Signal::Again
|
|
@@ -797,12 +801,12 @@ class WEEL
|
|
|
797
801
|
raise waitingresult[1] if !waitingresult.nil? && waitingresult.is_a?(Array) && waitingresult.length == 2 && waitingresult[0] == WEEL::Signal::Error
|
|
798
802
|
|
|
799
803
|
if Thread.current[:nolongernecessary]
|
|
800
|
-
|
|
804
|
+
connectionwrapper.activity_no_longer_necessary
|
|
801
805
|
raise Signal::NoLongerNecessary
|
|
802
806
|
end
|
|
803
807
|
if self.__weel_state == :stopping || self.__weel_state == :finishing
|
|
804
|
-
|
|
805
|
-
wp.passthrough =
|
|
808
|
+
connectionwrapper.activity_stop
|
|
809
|
+
wp.passthrough = connectionwrapper.activity_passthrough_value
|
|
806
810
|
raise Signal::Proceed if wp.passthrough # if stop, but no passthrough, let manipulate happen and then stop
|
|
807
811
|
end
|
|
808
812
|
|
|
@@ -814,26 +818,26 @@ class WEEL
|
|
|
814
818
|
finalize
|
|
815
819
|
end
|
|
816
820
|
if code.is_a?(Proc) || code.is_a?(String)
|
|
817
|
-
|
|
821
|
+
connectionwrapper.inform_activity_manipulate
|
|
818
822
|
if code.is_a?(Proc)
|
|
819
|
-
mr = ManipulateStructure.new(@__weel_data,@__weel_endpoints,@__weel_status,
|
|
823
|
+
mr = ManipulateStructure.new(@__weel_data,@__weel_endpoints,@__weel_status,connectionwrapper.additional)
|
|
820
824
|
ma = catch Signal::Again do
|
|
821
825
|
case code.arity
|
|
822
|
-
when 1; mr.instance_exec(
|
|
823
|
-
when 2; mr.instance_exec(
|
|
826
|
+
when 1; mr.instance_exec(connectionwrapper.activity_result_value,&code)
|
|
827
|
+
when 2; mr.instance_exec(connectionwrapper.activity_result_value,&code)
|
|
824
828
|
else
|
|
825
829
|
mr.instance_exec(&code)
|
|
826
830
|
end
|
|
827
831
|
'yes' # ma sadly will have nil when i just throw
|
|
828
832
|
end
|
|
829
833
|
elsif code.is_a?(String)
|
|
830
|
-
mr = ManipulateStructure.new(@__weel_data,@__weel_endpoints,@__weel_status,
|
|
834
|
+
mr = ManipulateStructure.new(@__weel_data,@__weel_endpoints,@__weel_status,connectionwrapper.additional)
|
|
831
835
|
ma = catch Signal::Again do
|
|
832
|
-
|
|
836
|
+
connectionwrapper.manipulate(mr,code,connectionwrapper.activity_result_value,connectionwrapper.activity_result_options)
|
|
833
837
|
'yes' # ma sadly will have nil when i just throw
|
|
834
838
|
end
|
|
835
839
|
end
|
|
836
|
-
|
|
840
|
+
connectionwrapper.inform_manipulate_change(
|
|
837
841
|
(mr.changed_status ? @__weel_status : nil),
|
|
838
842
|
(mr.changed_data.any? ? mr.changed_data.uniq : nil),
|
|
839
843
|
(mr.changed_endpoints.any? ? mr.changed_endpoints.uniq : nil),
|
|
@@ -843,18 +847,18 @@ class WEEL
|
|
|
843
847
|
throw(Signal::Again, Signal::Again) if ma.nil?
|
|
844
848
|
end
|
|
845
849
|
end while waitingresult == Signal::Again
|
|
846
|
-
if
|
|
847
|
-
|
|
850
|
+
if connectionwrapper.activity_passthrough_value.nil?
|
|
851
|
+
connectionwrapper.inform_activity_done
|
|
848
852
|
wp.passthrough = nil
|
|
849
853
|
wp.detail = :after
|
|
850
|
-
@
|
|
854
|
+
@__weel_connectionwrapper::inform_position_change @__weel_connectionwrapper_args, :after => [wp]
|
|
851
855
|
end
|
|
852
856
|
end
|
|
853
857
|
end while again == Signal::Again
|
|
854
858
|
end
|
|
855
859
|
raise Signal::Proceed
|
|
856
860
|
rescue Signal::SkipManipulate, Signal::Proceed
|
|
857
|
-
if self.__weel_state != :stopping && self.__weel_state != :finishing && !
|
|
861
|
+
if self.__weel_state != :stopping && self.__weel_state != :finishing && !connectionwrapper.vote_sync_after
|
|
858
862
|
self.__weel_state = :stopping
|
|
859
863
|
wp.detail = :unmark
|
|
860
864
|
end
|
|
@@ -862,19 +866,19 @@ class WEEL
|
|
|
862
866
|
@__weel_positions.delete wp
|
|
863
867
|
Thread.current[:branch_position] = nil
|
|
864
868
|
wp.detail = :unmark
|
|
865
|
-
@
|
|
869
|
+
@__weel_connectionwrapper::inform_position_change @__weel_connectionwrapper_args, :unmark => [wp]
|
|
866
870
|
rescue Signal::StopSkipManipulate, Signal::Stop
|
|
867
871
|
self.__weel_state = :stopping
|
|
868
872
|
rescue Signal::Skip
|
|
869
873
|
nil
|
|
870
874
|
rescue SyntaxError => se
|
|
871
|
-
|
|
875
|
+
connectionwrapper.inform_activity_failed se
|
|
872
876
|
self.__weel_state = :stopping
|
|
873
877
|
rescue => err
|
|
874
|
-
@
|
|
878
|
+
@__weel_connectionwrapper::inform_connectionwrapper_error @__weel_connectionwrapper_args, err
|
|
875
879
|
self.__weel_state = :stopping
|
|
876
880
|
ensure
|
|
877
|
-
|
|
881
|
+
connectionwrapper.mem_guard unless connectionwrapper.nil?
|
|
878
882
|
if Thread.current[:branch_parent]
|
|
879
883
|
Thread.current[:branch_parent][:mutex].synchronize do
|
|
880
884
|
if Thread.current[:branch_parent][:branch_wait_count_cancel_condition] == :first
|
|
@@ -938,7 +942,7 @@ class WEEL
|
|
|
938
942
|
position
|
|
939
943
|
else
|
|
940
944
|
self.__weel_state = :stopping
|
|
941
|
-
@
|
|
945
|
+
@__weel_connectionwrapper::inform_syntax_error(@__weel_connectionwrapper_args,Exception.new("position (#{position}) not valid"),nil)
|
|
942
946
|
end
|
|
943
947
|
end # }}}
|
|
944
948
|
|
|
@@ -967,13 +971,13 @@ class WEEL
|
|
|
967
971
|
def __weel_sim_start(what,options={}) #{{{
|
|
968
972
|
current_branch_sim_pos = Thread.current[:branch_sim_pos]
|
|
969
973
|
Thread.current[:branch_sim_pos] = @__weel_sim += 1
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
[
|
|
974
|
+
connectionwrapper = @__weel_connectionwrapper.new @__weel_connectionwrapper_args
|
|
975
|
+
connectionwrapper.simulate(what,:start,Thread.current[:branch_sim_pos],current_branch_sim_pos,options)
|
|
976
|
+
[connectionwrapper, current_branch_sim_pos]
|
|
973
977
|
end #}}}
|
|
974
978
|
|
|
975
|
-
def __weel_sim_stop(what,
|
|
976
|
-
|
|
979
|
+
def __weel_sim_stop(what,connectionwrapper,current_branch_sim_pos,options={}) #{{{
|
|
980
|
+
connectionwrapper.simulate(what,:end,Thread.current[:branch_sim_pos],current_branch_sim_pos,options)
|
|
977
981
|
Thread.current[:branch_sim_pos] = current_branch_sim_pos
|
|
978
982
|
end #}}}
|
|
979
983
|
|
|
@@ -981,7 +985,7 @@ class WEEL
|
|
|
981
985
|
def __weel_finalize #{{{
|
|
982
986
|
__weel_recursive_join(@__weel_main)
|
|
983
987
|
@__weel_state = :stopped
|
|
984
|
-
@
|
|
988
|
+
@__weel_connectionwrapper::inform_state_change @__weel_connectionwrapper_args, @__weel_state
|
|
985
989
|
end #}}}
|
|
986
990
|
|
|
987
991
|
def __weel_state=(newState)# {{{
|
|
@@ -996,7 +1000,7 @@ class WEEL
|
|
|
996
1000
|
__weel_replay = false
|
|
997
1001
|
end
|
|
998
1002
|
|
|
999
|
-
@
|
|
1003
|
+
@__weel_connectionwrapper::inform_state_change @__weel_connectionwrapper_args, @__weel_state
|
|
1000
1004
|
end # }}}
|
|
1001
1005
|
|
|
1002
1006
|
end # }}}
|
|
@@ -1006,27 +1010,27 @@ public
|
|
|
1006
1010
|
@dslr.__weel_positions
|
|
1007
1011
|
end # }}}
|
|
1008
1012
|
|
|
1009
|
-
# set the
|
|
1010
|
-
def
|
|
1011
|
-
@dslr.
|
|
1013
|
+
# set the connectionwrapper
|
|
1014
|
+
def connectionwrapper # {{{
|
|
1015
|
+
@dslr.__weel_connectionwrapper
|
|
1012
1016
|
end # }}}
|
|
1013
|
-
def
|
|
1014
|
-
superclass =
|
|
1017
|
+
def connectionwrapper=(new_weel_connectionwrapper) # {{{
|
|
1018
|
+
superclass = new_weel_connectionwrapper
|
|
1015
1019
|
while superclass
|
|
1016
|
-
check_ok = true if superclass == WEEL::
|
|
1020
|
+
check_ok = true if superclass == WEEL::ConnectionWrapperBase
|
|
1017
1021
|
superclass = superclass.superclass
|
|
1018
1022
|
end
|
|
1019
|
-
raise "
|
|
1020
|
-
@dslr.
|
|
1023
|
+
raise "ConnectionWrapper is not inherited from ConnectionWrapperBase" unless check_ok
|
|
1024
|
+
@dslr.__weel_connectionwrapper = new_weel_connectionwrapper
|
|
1021
1025
|
end # }}}
|
|
1022
1026
|
|
|
1023
|
-
# Get/Set the
|
|
1024
|
-
def
|
|
1025
|
-
@dslr.
|
|
1027
|
+
# Get/Set the connectionwrapper arguments
|
|
1028
|
+
def connectionwrapper_args # {{{
|
|
1029
|
+
@dslr.__weel_connectionwrapper_args
|
|
1026
1030
|
end # }}}
|
|
1027
|
-
def
|
|
1031
|
+
def connectionwrapper_args=(args) # {{{
|
|
1028
1032
|
if args.class == Array
|
|
1029
|
-
@dslr.
|
|
1033
|
+
@dslr.__weel_connectionwrapper_args = args
|
|
1030
1034
|
end
|
|
1031
1035
|
nil
|
|
1032
1036
|
end # }}}
|
|
@@ -1036,7 +1040,7 @@ public
|
|
|
1036
1040
|
@dslr.__weel_state
|
|
1037
1041
|
end # }}}
|
|
1038
1042
|
def state_signal # {{{
|
|
1039
|
-
|
|
1043
|
+
connectionwrapper::inform_state_change connectionwrapper_args, state
|
|
1040
1044
|
state
|
|
1041
1045
|
end # }}}
|
|
1042
1046
|
def abandon # {{{
|
|
@@ -1100,19 +1104,19 @@ public
|
|
|
1100
1104
|
end
|
|
1101
1105
|
rescue SyntaxError => se
|
|
1102
1106
|
@dslr.__weel_state = :stopping
|
|
1103
|
-
@dslr.
|
|
1107
|
+
@dslr.__weel_connectionwrapper::inform_syntax_error(@dslr.__weel_connectionwrapper_args,Exception.new(se.message),code)
|
|
1104
1108
|
rescue NameError => err # don't look into it, or it will explode
|
|
1105
1109
|
@dslr.__weel_state = :stopping
|
|
1106
|
-
@dslr.
|
|
1110
|
+
@dslr.__weel_connectionwrapper::inform_syntax_error(@dslr.__weel_connectionwrapper_args,Exception.new("main: `#{err.name}` is not a thing that can be used. Maybe it is meant to be a string and you forgot quotes?"),code)
|
|
1107
1111
|
rescue => err
|
|
1108
1112
|
@dslr.__weel_state = :stopping
|
|
1109
|
-
@dslr.
|
|
1113
|
+
@dslr.__weel_connectionwrapper::inform_syntax_error(@dslr.__weel_connectionwrapper_args,Exception.new(err.message),code)
|
|
1110
1114
|
end
|
|
1111
1115
|
if @dslr.__weel_state == :running || @dslr.__weel_state == :finishing
|
|
1112
1116
|
ipc = { :unmark => [] }
|
|
1113
1117
|
@dslr.__weel_positions.each{ |wp| ipc[:unmark] << wp }
|
|
1114
1118
|
@dslr.__weel_positions.clear
|
|
1115
|
-
@dslr.
|
|
1119
|
+
@dslr.__weel_connectionwrapper::inform_position_change(@dslr.__weel_connectionwrapper_args,ipc)
|
|
1116
1120
|
@dslr.__weel_state = :finished
|
|
1117
1121
|
end
|
|
1118
1122
|
if @dslr.__weel_state == :simulating
|
|
@@ -1145,7 +1149,7 @@ public
|
|
|
1145
1149
|
rescue => e
|
|
1146
1150
|
puts e.message
|
|
1147
1151
|
puts e.backtrace
|
|
1148
|
-
|
|
1152
|
+
connectionwrapper::inform_connectionwrapper_error connectionwrapper_args, e
|
|
1149
1153
|
end
|
|
1150
1154
|
end
|
|
1151
1155
|
end # }}}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
# Apache License, Version 2.0
|
|
2
|
-
#
|
|
2
|
+
#
|
|
3
3
|
# Copyright (c) 2013 Juergen Mangler
|
|
4
|
-
#
|
|
4
|
+
#
|
|
5
5
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
6
|
# you may not use this file except in compliance with the License.
|
|
7
7
|
# You may obtain a copy of the License at
|
|
8
|
-
#
|
|
8
|
+
#
|
|
9
9
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
-
#
|
|
10
|
+
#
|
|
11
11
|
# Unless required by applicable law or agreed to in writing, software
|
|
12
12
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
13
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
@@ -15,18 +15,18 @@
|
|
|
15
15
|
# limitations under the License.
|
|
16
16
|
|
|
17
17
|
######
|
|
18
|
-
# ADVENTURE Simulation Trace Generator
|
|
18
|
+
# ADVENTURE Simulation Trace Generator Connection Wrapper
|
|
19
19
|
######
|
|
20
20
|
|
|
21
21
|
module TraceBasics #{{{
|
|
22
22
|
def <<(item)
|
|
23
23
|
@elements << item
|
|
24
|
-
item.parent = self
|
|
24
|
+
item.parent = self
|
|
25
25
|
end
|
|
26
26
|
def each
|
|
27
27
|
@elements.each do |ele|
|
|
28
28
|
yield ele
|
|
29
|
-
end
|
|
29
|
+
end
|
|
30
30
|
end
|
|
31
31
|
end #}}}
|
|
32
32
|
|
|
@@ -42,11 +42,11 @@ class Trace #{{{
|
|
|
42
42
|
end
|
|
43
43
|
def recursive_get_container(container,tid)
|
|
44
44
|
return container if container.respond_to?(:tid) and container.tid == tid
|
|
45
|
-
container.each do |ele|
|
|
45
|
+
container.each do |ele|
|
|
46
46
|
if ele.kind_of?(TraceContainer)
|
|
47
|
-
ret = recursive_get_container(ele,tid)
|
|
47
|
+
ret = recursive_get_container(ele,tid)
|
|
48
48
|
return ret unless ret.nil?
|
|
49
|
-
end
|
|
49
|
+
end
|
|
50
50
|
end
|
|
51
51
|
nil
|
|
52
52
|
end
|
|
@@ -79,7 +79,7 @@ class Trace #{{{
|
|
|
79
79
|
tmp = recursive_generate_list(ele,options)
|
|
80
80
|
add_traces(traces,tmp)
|
|
81
81
|
options[:otherwise] = true
|
|
82
|
-
end
|
|
82
|
+
end
|
|
83
83
|
end
|
|
84
84
|
traces
|
|
85
85
|
end
|
|
@@ -137,7 +137,7 @@ class TraceChoose < TraceContainer
|
|
|
137
137
|
def initialize(tid,mode)
|
|
138
138
|
super tid
|
|
139
139
|
@mode = mode
|
|
140
|
-
end
|
|
140
|
+
end
|
|
141
141
|
end
|
|
142
142
|
class TraceAlternative < TraceContainer; end
|
|
143
143
|
class TraceOtherwise < TraceContainer; end
|
|
@@ -145,10 +145,10 @@ class TraceOtherwise < TraceContainer; end
|
|
|
145
145
|
class PlainTrace
|
|
146
146
|
def initialize
|
|
147
147
|
@container
|
|
148
|
-
end
|
|
148
|
+
end
|
|
149
149
|
end
|
|
150
150
|
|
|
151
|
-
class
|
|
151
|
+
class SimConnectionWrapper < WEEL::ConnectionWrapperBase
|
|
152
152
|
def initialize(args,endpoint=nil,position=nil,continue=nil)
|
|
153
153
|
@__myhandler_stopped = false
|
|
154
154
|
@__myhandler_position = position
|
|
@@ -172,19 +172,19 @@ class SimHandlerWrapper < WEEL::HandlerWrapperBase
|
|
|
172
172
|
clast = $trace.get_container(parent)
|
|
173
173
|
until clast.kind_of?(TraceParallel)
|
|
174
174
|
clast = clast.parent
|
|
175
|
-
end
|
|
175
|
+
end
|
|
176
176
|
clast << TraceParallelBranch.new(tid,parent)
|
|
177
177
|
else
|
|
178
178
|
clast = $trace.get_container(tid)
|
|
179
179
|
clast.close! if clast.open?
|
|
180
|
-
end
|
|
180
|
+
end
|
|
181
181
|
when :choose
|
|
182
182
|
simulate_add_to_container($trace,nesting,parent,tid) { TraceChoose.new(tid,parameters[:mode]) }
|
|
183
183
|
when :alternative
|
|
184
184
|
simulate_add_to_container($trace,nesting,parent,tid) { TraceAlternative.new(tid) }
|
|
185
185
|
when :otherwise
|
|
186
186
|
simulate_add_to_container($trace,nesting,parent,tid) { TraceOtherwise.new(tid) }
|
|
187
|
-
end
|
|
187
|
+
end
|
|
188
188
|
end
|
|
189
189
|
|
|
190
190
|
private
|
|
@@ -196,7 +196,7 @@ class SimHandlerWrapper < WEEL::HandlerWrapperBase
|
|
|
196
196
|
else
|
|
197
197
|
clast = trace.get_container(tid)
|
|
198
198
|
clast.close! if clast.open?
|
|
199
|
-
end
|
|
199
|
+
end
|
|
200
200
|
end #}}}
|
|
201
201
|
|
|
202
202
|
end
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
class
|
|
1
|
+
class TestConnectionWrapper < WEEL::ConnectionWrapperBase
|
|
2
2
|
def self::inform_state_change(arguments,newstate)
|
|
3
3
|
$long_track += "---> STATE #{newstate}\n"
|
|
4
4
|
$short_track << "|#{newstate}|"
|
|
@@ -8,7 +8,7 @@ class TestHandlerWrapper < WEEL::HandlerWrapperBase
|
|
|
8
8
|
$short_track << "E"
|
|
9
9
|
raise(err)
|
|
10
10
|
end
|
|
11
|
-
def self::
|
|
11
|
+
def self::inform_connectionwrapper_error(arguments,err)
|
|
12
12
|
$long_track += "HW ERROR: #{err}\n"
|
|
13
13
|
$short_track << "E"
|
|
14
14
|
end
|
data/test/TestWorkflow.rb
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
require File.expand_path(::File.dirname(__FILE__) + '/../lib/weel')
|
|
2
2
|
require File.expand_path(::File.dirname(__FILE__) + '/TestMixin')
|
|
3
|
-
require File.expand_path(::File.dirname(__FILE__) + '/
|
|
3
|
+
require File.expand_path(::File.dirname(__FILE__) + '/TestConnectionWrapper')
|
|
4
4
|
|
|
5
5
|
class TestWorkflow < WEEL
|
|
6
|
-
|
|
6
|
+
connectionwrapper TestConnectionWrapper
|
|
7
7
|
|
|
8
8
|
endpoint :endpoint1 => 'http://www.heise.de'
|
|
9
9
|
endpoint :stop => 'stop it'
|
data/test/basic/tc_handler.rb
CHANGED
|
@@ -6,14 +6,14 @@ class TestCaseHandler < Test::Unit::TestCase
|
|
|
6
6
|
|
|
7
7
|
def test_handler
|
|
8
8
|
assert_raise RuntimeError do
|
|
9
|
-
@wf.
|
|
9
|
+
@wf.connectionwrapper = String
|
|
10
10
|
end
|
|
11
11
|
assert_nothing_raised do
|
|
12
|
-
@wf.
|
|
12
|
+
@wf.connectionwrapper = TestConnectionWrapper
|
|
13
13
|
end
|
|
14
14
|
end
|
|
15
15
|
def test_handlerargs
|
|
16
|
-
@wf.
|
|
17
|
-
assert(@wf.
|
|
16
|
+
@wf.connectionwrapper_args = ["1", "2"]
|
|
17
|
+
assert(@wf.connectionwrapper_args.is_a?(Array), "Handler arguments is not an array, it is a #{@wf.connectionwrapper_args.inspect}")
|
|
18
18
|
end
|
|
19
19
|
end
|
data/weel.gemspec
CHANGED
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.
|
|
4
|
+
version: 1.99.101
|
|
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:
|
|
12
|
+
date: 2022-03-21 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: test-unit
|
|
@@ -45,8 +45,8 @@ files:
|
|
|
45
45
|
- lib/weel.rb
|
|
46
46
|
- test/ContinueTest.rb
|
|
47
47
|
- test/README
|
|
48
|
-
- test/
|
|
49
|
-
- test/
|
|
48
|
+
- test/SimConnectionWrapper.rb
|
|
49
|
+
- test/TestConnectionWrapper.rb
|
|
50
50
|
- test/TestMixin.rb
|
|
51
51
|
- test/TestWorkflow.rb
|
|
52
52
|
- test/basic/tc_choose.rb
|
|
@@ -101,46 +101,46 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
101
101
|
- !ruby/object:Gem::Version
|
|
102
102
|
version: '0'
|
|
103
103
|
requirements: []
|
|
104
|
-
rubygems_version: 3.
|
|
104
|
+
rubygems_version: 3.2.22
|
|
105
105
|
signing_key:
|
|
106
106
|
specification_version: 4
|
|
107
107
|
summary: Workflow Execution Engine Library (WEEL)
|
|
108
108
|
test_files:
|
|
109
|
-
- test/TestHandlerWrapper.rb
|
|
110
|
-
- test/test
|
|
111
109
|
- test/ContinueTest.rb
|
|
112
|
-
- test/TestWorkflow.rb
|
|
113
|
-
- test/TestMixin.rb
|
|
114
|
-
- test/SimHandlerWrapper.rb
|
|
115
110
|
- test/README
|
|
116
|
-
- test/
|
|
117
|
-
- test/
|
|
118
|
-
- test/
|
|
119
|
-
- test/
|
|
120
|
-
- test/
|
|
121
|
-
- test/
|
|
111
|
+
- test/SimConnectionWrapper.rb
|
|
112
|
+
- test/TestConnectionWrapper.rb
|
|
113
|
+
- test/TestMixin.rb
|
|
114
|
+
- test/TestWorkflow.rb
|
|
115
|
+
- test/test
|
|
116
|
+
- test/basic/tc_choose.rb
|
|
117
|
+
- test/basic/tc_codereplace.rb
|
|
118
|
+
- test/basic/tc_data.rb
|
|
119
|
+
- test/basic/tc_endpoint.rb
|
|
120
|
+
- test/basic/tc_handler.rb
|
|
121
|
+
- test/basic/tc_parallel.rb
|
|
122
|
+
- test/basic/tc_search.rb
|
|
123
|
+
- test/basic/tc_state.rb
|
|
124
|
+
- test/basic/tc_wf_control.rb
|
|
125
|
+
- test/complex/tc_generalsynchonizingmerge_loopsearch.rb
|
|
126
|
+
- test/complex/tc_parallel_stop.rb
|
|
127
|
+
- test/complexsearch/tc_search.rb
|
|
128
|
+
- test/exec/tc_again.rb
|
|
129
|
+
- test/exec/tc_exec.rb
|
|
130
|
+
- test/speed/tc_speed1.rb
|
|
131
|
+
- test/speed/tc_speed2.rb
|
|
122
132
|
- test/wfp_adv_branching/tc_generalizedjoin.rb
|
|
123
133
|
- test/wfp_adv_branching/tc_generalsynchronizingmerge.rb
|
|
134
|
+
- test/wfp_adv_branching/tc_localsynchronizingmerge.rb
|
|
135
|
+
- test/wfp_adv_branching/tc_multichoice_structuredsynchronizingmerge.rb
|
|
124
136
|
- test/wfp_adv_branching/tc_multimerge.rb
|
|
125
137
|
- test/wfp_adv_branching/tc_structured_discriminator.rb
|
|
126
|
-
- test/
|
|
127
|
-
- test/
|
|
128
|
-
- test/
|
|
129
|
-
- test/speed/tc_speed2.rb
|
|
130
|
-
- test/exec/tc_again.rb
|
|
131
|
-
- test/exec/tc_exec.rb
|
|
132
|
-
- test/wfp_basic/tc_parallelsplit_synchronization.rb
|
|
138
|
+
- test/wfp_adv_branching/tc_structured_partial_join.rb
|
|
139
|
+
- test/wfp_adv_branching/tc_threadmerge.rb
|
|
140
|
+
- test/wfp_adv_branching/tc_threadsplit.rb
|
|
133
141
|
- test/wfp_basic/tc_exclusivechoice_simplemerge.rb
|
|
142
|
+
- test/wfp_basic/tc_parallelsplit_synchronization.rb
|
|
134
143
|
- test/wfp_basic/tc_sequence.rb
|
|
135
|
-
- test/
|
|
136
|
-
- test/
|
|
137
|
-
- test/
|
|
138
|
-
- test/basic/tc_endpoint.rb
|
|
139
|
-
- test/basic/tc_data.rb
|
|
140
|
-
- test/basic/tc_choose.rb
|
|
141
|
-
- test/basic/tc_search.rb
|
|
142
|
-
- test/basic/tc_handler.rb
|
|
143
|
-
- test/basic/tc_codereplace.rb
|
|
144
|
-
- test/basic/tc_wf_control.rb
|
|
145
|
-
- test/basic/tc_parallel.rb
|
|
146
|
-
- test/complexsearch/tc_search.rb
|
|
144
|
+
- test/wfp_iteration/tc_structuredloop.rb
|
|
145
|
+
- test/wfp_state_based/tc_deferredchoice.rb
|
|
146
|
+
- test/wfp_state_based/tc_interleavedparallelrouting.rb
|