weel 1.99.118 → 1.99.121
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 +133 -95
- data/test/TestConnectionWrapper.rb +6 -1
- data/test/basic/tc_wf_control.rb +23 -2
- data/weel.gemspec +2 -2
- metadata +4 -8
- data/test/basic/tc_wf_stop.rb +0 -34
- data/test/test +0 -39
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e3dc94f3d9dc7b182dc017f529211878cdbffa2504d1f863220d0820b786e28b
|
|
4
|
+
data.tar.gz: 816645f85946983a86ba373e4e5e660b2688fc32c57e0f72e44a4d71a774b9b0
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a22047ce8e533de6326a7cccbdb25a7dfabc5b137880b111ff2032cdb1d32bd45f0f3fccb421e72f4d823a8d84a6fd3ec67d81ee3e1bef0b61c755621e28bee2
|
|
7
|
+
data.tar.gz: 5ebc7c1d4a819a23ee2399be8818f80b7de71fb6753351750d3dbabe2ad122f6be6fe783f30d3d5acd00e1ff927c57f90b0c5052b8195d889420b217625cf37d
|
data/lib/weel.rb
CHANGED
|
@@ -86,6 +86,17 @@ class WEEL
|
|
|
86
86
|
end
|
|
87
87
|
end
|
|
88
88
|
end
|
|
89
|
+
def update(d,e,s)
|
|
90
|
+
d.each do |k,v|
|
|
91
|
+
data.send(k+'=',v)
|
|
92
|
+
end if d
|
|
93
|
+
e.each do |k,v|
|
|
94
|
+
endpoints.send(k+'=',v)
|
|
95
|
+
end if e
|
|
96
|
+
if s
|
|
97
|
+
status.update(s['id'],s['message'])
|
|
98
|
+
end
|
|
99
|
+
end
|
|
89
100
|
def data
|
|
90
101
|
ReadHash.new(@__weel_data)
|
|
91
102
|
end
|
|
@@ -139,6 +150,18 @@ class WEEL
|
|
|
139
150
|
end
|
|
140
151
|
end
|
|
141
152
|
|
|
153
|
+
def update(d,e,s)
|
|
154
|
+
d.each do |k,v|
|
|
155
|
+
data.send(k+'=',v)
|
|
156
|
+
end if d
|
|
157
|
+
e.each do |k,v|
|
|
158
|
+
endpoints.send(k+'=',v)
|
|
159
|
+
end if e
|
|
160
|
+
if s
|
|
161
|
+
status.update(s['id'],s['message'])
|
|
162
|
+
end
|
|
163
|
+
end
|
|
164
|
+
|
|
142
165
|
def changed_data
|
|
143
166
|
@touched_data.each do |e|
|
|
144
167
|
td = Marshal.dump(@__weel_data[e]) rescue nil
|
|
@@ -146,10 +169,10 @@ class WEEL
|
|
|
146
169
|
@changed_data << e
|
|
147
170
|
end
|
|
148
171
|
end
|
|
149
|
-
@changed_data
|
|
172
|
+
@changed_data.uniq
|
|
150
173
|
end
|
|
151
174
|
def changed_endpoints
|
|
152
|
-
@changed_endpoints
|
|
175
|
+
@changed_endpoints.uniq
|
|
153
176
|
end
|
|
154
177
|
|
|
155
178
|
def original_data
|
|
@@ -236,6 +259,12 @@ class WEEL
|
|
|
236
259
|
def wait_until_nudged!
|
|
237
260
|
@nudge.pop
|
|
238
261
|
end
|
|
262
|
+
def to_json(*a)
|
|
263
|
+
{
|
|
264
|
+
'id' => @id,
|
|
265
|
+
'message' => @message
|
|
266
|
+
}.to_json(*a)
|
|
267
|
+
end
|
|
239
268
|
attr_reader :id, :message
|
|
240
269
|
end #}}}
|
|
241
270
|
|
|
@@ -354,9 +383,19 @@ class WEEL
|
|
|
354
383
|
def callback(result=nil,options={}); end
|
|
355
384
|
def mem_guard; end
|
|
356
385
|
|
|
357
|
-
def test_condition(
|
|
386
|
+
def test_condition(dataelements,endpoints,local,additional,code,args={}); ReadStructure.new(dataelements,endpoints,local,additional).instance_eval(code); end
|
|
387
|
+
def eval_expression(dataelements,endpoints,local,additional,code); ReadStructure.new(dataelements,endpoints,local,additional).instance_eval(code); end
|
|
388
|
+
def manipulate(readonly,lock,dataelements,endpoints,status,local,additional,code,where,result=nil,options=nil)
|
|
389
|
+
lock.synchronize do
|
|
390
|
+
if readonly
|
|
391
|
+
ReadStructure.new(dataelements,endpoints,local,additional).instance_eval(code,where,1)
|
|
392
|
+
else
|
|
393
|
+
ManipulateStructure.new(dataelements,endpoints,local,additional).instance_eval(code,where,1)
|
|
394
|
+
end
|
|
395
|
+
end
|
|
396
|
+
end
|
|
397
|
+
|
|
358
398
|
def join_branches(branches); end
|
|
359
|
-
def manipulate(mr,code,where,result=nil,options=nil); mr.instance_eval(code,where,1); end
|
|
360
399
|
end # }}}
|
|
361
400
|
|
|
362
401
|
class Position # {{{
|
|
@@ -461,9 +500,13 @@ class WEEL
|
|
|
461
500
|
@__weel_state = :ready
|
|
462
501
|
@__weel_status = Status.new(0,"undefined")
|
|
463
502
|
@__weel_sim = -1
|
|
503
|
+
@__weel_lock = Mutex.new
|
|
464
504
|
end #}}}
|
|
465
505
|
attr_accessor :__weel_search_positions, :__weel_positions, :__weel_main, :__weel_data, :__weel_endpoints, :__weel_connectionwrapper, :__weel_connectionwrapper_args
|
|
466
|
-
attr_reader :__weel_state, :__weel_status
|
|
506
|
+
attr_reader :__weel_state, :__weel_status, :__weel_status
|
|
507
|
+
|
|
508
|
+
# DSL-Construct for translating expressions into static parameters
|
|
509
|
+
def 🠊(code); __weel_eval_expression(code); end
|
|
467
510
|
|
|
468
511
|
# DSL-Constructs for atomic calls to external services (calls) and pure context manipulations (manipulate).
|
|
469
512
|
# Calls can also manipulate context (after the invoking the external services)
|
|
@@ -515,11 +558,12 @@ class WEEL
|
|
|
515
558
|
thread[:start_event]&.continue # sometimes start event might not even exist yet (i.e. race condition)
|
|
516
559
|
end
|
|
517
560
|
|
|
518
|
-
Thread.current[:branch_event].wait unless self.__weel_state == :stopping || self.__weel_state == :finishing || self.__weel_state == :stopped
|
|
561
|
+
Thread.current[:branch_event].wait unless self.__weel_state == :stopping || self.__weel_state == :finishing || self.__weel_state == :stopped || Thread.current[:branches].length == 0
|
|
519
562
|
|
|
520
563
|
__weel_sim_stop(:parallel,hw,pos) if __weel_sim
|
|
521
564
|
|
|
522
565
|
cw = @__weel_connectionwrapper.new @__weel_connectionwrapper_args
|
|
566
|
+
|
|
523
567
|
cw.join_branches(Thread.current[:branch_traces])
|
|
524
568
|
|
|
525
569
|
unless self.__weel_state == :stopping || self.__weel_state == :finishing || self.__weel_state == :stopped
|
|
@@ -635,11 +679,11 @@ class WEEL
|
|
|
635
679
|
# searchmode is active (to find the starting position)
|
|
636
680
|
def alternative(condition,args={},&block)# {{{
|
|
637
681
|
return if self.__weel_state == :stopping || self.__weel_state == :finishing || self.__weel_state == :stopped || Thread.current[:nolongernecessary]
|
|
638
|
-
hw, pos = __weel_sim_start(:alternative,args.merge(:mode => Thread.current[:alternative_mode].last, :condition => (
|
|
682
|
+
hw, pos = __weel_sim_start(:alternative,args.merge(:mode => Thread.current[:alternative_mode].last, :condition => (condition.is_a?(String) ? condition : nil))) if __weel_sim
|
|
639
683
|
Thread.current[:mutex] ||= Mutex.new
|
|
640
684
|
Thread.current[:mutex].synchronize do
|
|
641
685
|
return if Thread.current[:alternative_mode][-1] == :exclusive && Thread.current[:alternative_executed][-1] == true
|
|
642
|
-
if
|
|
686
|
+
if condition.is_a?(String) && !__weel_sim
|
|
643
687
|
condition = __weel_eval_condition(condition, args)
|
|
644
688
|
end
|
|
645
689
|
Thread.current[:alternative_executed][-1] = true if condition
|
|
@@ -647,7 +691,7 @@ class WEEL
|
|
|
647
691
|
searchmode = __weel_is_in_search_mode
|
|
648
692
|
__weel_protect_yield(&block) if searchmode || __weel_sim || condition
|
|
649
693
|
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
|
|
650
|
-
__weel_sim_stop(:alternative,hw,pos,args.merge(:mode => Thread.current[:alternative_mode].last, :condition => (
|
|
694
|
+
__weel_sim_stop(:alternative,hw,pos,args.merge(:mode => Thread.current[:alternative_mode].last, :condition => (condition.is_a?(String) ? condition : nil))) if __weel_sim
|
|
651
695
|
end # }}}
|
|
652
696
|
def otherwise(args={},&block) # {{{
|
|
653
697
|
return if self.__weel_state == :stopping || self.__weel_state == :finishing || self.__weel_state == :stopped || Thread.current[:nolongernecessary]
|
|
@@ -673,7 +717,7 @@ class WEEL
|
|
|
673
717
|
|
|
674
718
|
# Defines a Cycle (loop/iteration)
|
|
675
719
|
def loop(condition,args={},&block)# {{{
|
|
676
|
-
unless condition
|
|
720
|
+
unless condition[0].is_a?(String) && [:pre_test,:post_test].include?(condition[1]) && args.is_a?(Hash)
|
|
677
721
|
raise "condition must be called pre_test{} or post_test{}"
|
|
678
722
|
end
|
|
679
723
|
return if self.__weel_state == :stopping || self.__weel_state == :finishing || self.__weel_state == :stopped || Thread.current[:nolongernecessary]
|
|
@@ -690,7 +734,7 @@ class WEEL
|
|
|
690
734
|
end
|
|
691
735
|
end
|
|
692
736
|
if __weel_sim
|
|
693
|
-
cond = condition[0]
|
|
737
|
+
cond = condition[0]
|
|
694
738
|
hw, pos = __weel_sim_start(:loop,args.merge(:testing=>condition[1],:condition=>cond))
|
|
695
739
|
catch :escape do
|
|
696
740
|
__weel_protect_yield(&block)
|
|
@@ -781,8 +825,8 @@ class WEEL
|
|
|
781
825
|
|
|
782
826
|
def __weel_eval_condition(condition,args={}) #{{{
|
|
783
827
|
begin
|
|
784
|
-
connectionwrapper = @__weel_connectionwrapper.new @__weel_connectionwrapper_args
|
|
785
|
-
|
|
828
|
+
connectionwrapper = @__weel_connectionwrapper.new @__weel_connectionwrapper_args
|
|
829
|
+
connectionwrapper.test_condition(@__weel_data,@__weel_endpoints,Thread.current[:local],connectionwrapper.additional,condition,args)
|
|
786
830
|
rescue NameError => err # don't look into it, or it will explode
|
|
787
831
|
# if you access $! here, BOOOM
|
|
788
832
|
self.__weel_state = :stopping
|
|
@@ -795,6 +839,22 @@ class WEEL
|
|
|
795
839
|
end
|
|
796
840
|
end #}}}
|
|
797
841
|
|
|
842
|
+
def __weel_eval_expression(expression) #{{{
|
|
843
|
+
begin
|
|
844
|
+
connectionwrapper = @__weel_connectionwrapper.new @__weel_connectionwrapper_args
|
|
845
|
+
connectionwrapper.eval_expression(@__weel_data,@__weel_endpoints,Thread.current[:local],connectionwrapper.additional,expression)
|
|
846
|
+
rescue NameError => err # don't look into it, or it will explode
|
|
847
|
+
# if you access $! here, BOOOM
|
|
848
|
+
self.__weel_state = :stopping
|
|
849
|
+
@__weel_connectionwrapper::inform_syntax_error(@__weel_connectionwrapper_args,Exception.new("eval_expression: `#{err.name}` is not a thing that can be used. Maybe it is meant to be a string and you forgot quotes?"),nil)
|
|
850
|
+
nil
|
|
851
|
+
rescue => err
|
|
852
|
+
self.__weel_state = :stopping
|
|
853
|
+
@__weel_connectionwrapper::inform_syntax_error(@__weel_connectionwrapper_args,Exception.new(err.message),nil)
|
|
854
|
+
nil
|
|
855
|
+
end
|
|
856
|
+
end #}}}
|
|
857
|
+
|
|
798
858
|
def __weel_progress(position, uuid, skip=false) #{{{
|
|
799
859
|
ipc = {}
|
|
800
860
|
branch = Thread.current
|
|
@@ -855,28 +915,19 @@ class WEEL
|
|
|
855
915
|
|
|
856
916
|
wp = __weel_progress position, connectionwrapper.activity_uuid
|
|
857
917
|
|
|
858
|
-
# searchmode position is after, jump directly to vote_sync_after
|
|
859
|
-
raise Signal::Proceed if searchmode == :after
|
|
860
|
-
|
|
861
918
|
case type
|
|
862
919
|
when :manipulate
|
|
863
920
|
raise Signal::Stop unless connectionwrapper.vote_sync_before
|
|
864
921
|
raise Signal::Skip if self.__weel_state == :stopping || self.__weel_state == :finishing
|
|
865
922
|
|
|
866
|
-
if finalize.is_a?(
|
|
923
|
+
if finalize.is_a?(String)
|
|
867
924
|
connectionwrapper.activity_manipulate_handle(parameters)
|
|
868
925
|
connectionwrapper.inform_activity_manipulate
|
|
869
|
-
|
|
870
|
-
mr = ManipulateStructure.new(@__weel_data,@__weel_endpoints,@__weel_status,Thread.current[:local],connectionwrapper.additional)
|
|
871
|
-
mr.instance_eval(&finalize)
|
|
872
|
-
elsif finalize.is_a?(String)
|
|
873
|
-
mr = ManipulateStructure.new(@__weel_data,@__weel_endpoints,@__weel_status,Thread.current[:local],connectionwrapper.additional)
|
|
874
|
-
connectionwrapper.manipulate(mr,finalize,'Activity ' + position.to_s)
|
|
875
|
-
end
|
|
926
|
+
struct = connectionwrapper.manipulate(false,@__weel_lock,@__weel_data,@__weel_endpoints,@__weel_status,Thread.current[:local],connectionwrapper.additional,finalize,'Activity ' + position.to_s)
|
|
876
927
|
connectionwrapper.inform_manipulate_change(
|
|
877
|
-
((
|
|
878
|
-
((
|
|
879
|
-
((
|
|
928
|
+
((struct && struct.changed_status) ? @__weel_status : nil),
|
|
929
|
+
((struct && struct.changed_data.any?) ? struct.changed_data.uniq : nil),
|
|
930
|
+
((struct && struct.changed_endpoints.any?) ? struct.changed_endpoints.uniq : nil),
|
|
880
931
|
@__weel_data,
|
|
881
932
|
@__weel_endpoints
|
|
882
933
|
)
|
|
@@ -888,15 +939,13 @@ class WEEL
|
|
|
888
939
|
begin
|
|
889
940
|
again = catch Signal::Again do
|
|
890
941
|
connectionwrapper.mem_guard
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
connectionwrapper.manipulate(rs,prepare,'Activity ' + position.to_s)
|
|
897
|
-
end
|
|
942
|
+
struct = if prepare
|
|
943
|
+
connectionwrapper.manipulate(true,@__weel_lock,@__weel_data,@__weel_endpoints,@__weel_status,Thread.current[:local],connectionwrapper.additional,prepare,'Activity ' + position.to_s)
|
|
944
|
+
else
|
|
945
|
+
# just the read structure, no code exec necessary
|
|
946
|
+
ReadStructure.new(@__weel_data,@__weel_endpoints,Thread.current[:local],connectionwrapper.additional)
|
|
898
947
|
end
|
|
899
|
-
params = connectionwrapper.prepare(
|
|
948
|
+
params = connectionwrapper.prepare(struct,endpoint,parameters)
|
|
900
949
|
raise Signal::Stop unless connectionwrapper.vote_sync_before(params)
|
|
901
950
|
raise Signal::Skip if self.__weel_state == :stopping || self.__weel_state == :finishing
|
|
902
951
|
|
|
@@ -935,30 +984,19 @@ class WEEL
|
|
|
935
984
|
else
|
|
936
985
|
finalize
|
|
937
986
|
end
|
|
938
|
-
if code.is_a?(
|
|
987
|
+
if code.is_a?(String)
|
|
939
988
|
connectionwrapper.inform_activity_manipulate
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
else
|
|
947
|
-
mr.instance_exec(&code)
|
|
948
|
-
end
|
|
949
|
-
'yes' # ma sadly will have nil when i just throw
|
|
950
|
-
end
|
|
951
|
-
elsif code.is_a?(String)
|
|
952
|
-
mr = ManipulateStructure.new(@__weel_data,@__weel_endpoints,@__weel_status,Thread.current[:local],connectionwrapper.additional)
|
|
953
|
-
ma = catch Signal::Again do
|
|
954
|
-
connectionwrapper.manipulate(mr,code,'Activity ' + position.to_s,connectionwrapper.activity_result_value,connectionwrapper.activity_result_options)
|
|
955
|
-
'yes' # ma sadly will have nil when i just throw
|
|
956
|
-
end
|
|
989
|
+
struct = nil
|
|
990
|
+
|
|
991
|
+
# when you throw without parameters, ma contains nil, so we return Signal::Proceed to give ma a meaningful value in other cases
|
|
992
|
+
ma = catch Signal::Again do
|
|
993
|
+
struct = connectionwrapper.manipulate(false,@__weel_lock,@__weel_data,@__weel_endpoints,@__weel_status,Thread.current[:local],connectionwrapper.additional,code,'Activity ' + position.to_s,connectionwrapper.activity_result_value,connectionwrapper.activity_result_options)
|
|
994
|
+
Signal::Proceed
|
|
957
995
|
end
|
|
958
996
|
connectionwrapper.inform_manipulate_change(
|
|
959
|
-
(
|
|
960
|
-
(
|
|
961
|
-
(
|
|
997
|
+
((struct && struct.changed_status) ? @__weel_status : nil),
|
|
998
|
+
((struct && struct.changed_data.any?) ? struct.changed_data.uniq : nil),
|
|
999
|
+
((struct && struct.changed_endpoints.any?) ? struct.changed_endpoints.uniq : nil),
|
|
962
1000
|
@__weel_data,
|
|
963
1001
|
@__weel_endpoints
|
|
964
1002
|
)
|
|
@@ -1166,45 +1204,6 @@ public
|
|
|
1166
1204
|
@dslr.__weel_state = :abandoned
|
|
1167
1205
|
end # }}}
|
|
1168
1206
|
|
|
1169
|
-
# Set search positions
|
|
1170
|
-
# set new_weel_search to a boolean (or anything else) to start the process from beginning (reset serach positions)
|
|
1171
|
-
def search(new_weel_search=false) # {{{
|
|
1172
|
-
@dslr.__weel_search_positions.clear
|
|
1173
|
-
|
|
1174
|
-
new_weel_search = [new_weel_search] if new_weel_search.is_a?(Position)
|
|
1175
|
-
|
|
1176
|
-
if !new_weel_search.is_a?(Array) || new_weel_search.empty?
|
|
1177
|
-
false
|
|
1178
|
-
else
|
|
1179
|
-
new_weel_search.each do |search_position|
|
|
1180
|
-
@dslr.__weel_search_positions[search_position.position] = search_position
|
|
1181
|
-
end
|
|
1182
|
-
true
|
|
1183
|
-
end
|
|
1184
|
-
end # }}}
|
|
1185
|
-
|
|
1186
|
-
def data(new_data=nil) # {{{
|
|
1187
|
-
unless new_data.nil? || !new_data.is_a?(Hash)
|
|
1188
|
-
new_data.each{ |k,v| @dslr.__weel_data[k] = v }
|
|
1189
|
-
end
|
|
1190
|
-
@dslr.__weel_data
|
|
1191
|
-
end # }}}
|
|
1192
|
-
def endpoints(new_endpoints=nil) # {{{
|
|
1193
|
-
unless new_endpoints.nil? || !new_endpoints.is_a?(Hash)
|
|
1194
|
-
new_endpoints.each{ |k,v| @dslr.__weel_endpoints[k] = v }
|
|
1195
|
-
end
|
|
1196
|
-
@dslr.__weel_endpoints
|
|
1197
|
-
end # }}}
|
|
1198
|
-
def endpoint(new_endpoints) # {{{
|
|
1199
|
-
unless new_endpoints.nil? || !new_endpoints.is_a?(Hash) || !new_endpoints.length == 1
|
|
1200
|
-
new_endpoints.each{ |k,v| @dslr.__weel_endpoints[k] = v }
|
|
1201
|
-
end
|
|
1202
|
-
nil
|
|
1203
|
-
end # }}}
|
|
1204
|
-
def status # {{{
|
|
1205
|
-
@dslr.__weel_status
|
|
1206
|
-
end # }}}
|
|
1207
|
-
|
|
1208
1207
|
# get/set workflow description
|
|
1209
1208
|
def description(&blk)
|
|
1210
1209
|
self.description=(blk)
|
|
@@ -1248,6 +1247,45 @@ public
|
|
|
1248
1247
|
end
|
|
1249
1248
|
end # }}}
|
|
1250
1249
|
|
|
1250
|
+
# Set search positions
|
|
1251
|
+
# set new_weel_search to a boolean (or anything else) to start the process from beginning (reset serach positions)
|
|
1252
|
+
def search(new_weel_search=false) # {{{
|
|
1253
|
+
@dslr.__weel_search_positions.clear
|
|
1254
|
+
|
|
1255
|
+
new_weel_search = [new_weel_search] if new_weel_search.is_a?(Position)
|
|
1256
|
+
|
|
1257
|
+
if !new_weel_search.is_a?(Array) || new_weel_search.empty?
|
|
1258
|
+
false
|
|
1259
|
+
else
|
|
1260
|
+
new_weel_search.each do |search_position|
|
|
1261
|
+
@dslr.__weel_search_positions[search_position.position] = search_position
|
|
1262
|
+
end
|
|
1263
|
+
true
|
|
1264
|
+
end
|
|
1265
|
+
end # }}}
|
|
1266
|
+
|
|
1267
|
+
def data(new_data=nil) # {{{
|
|
1268
|
+
unless new_data.nil? || !new_data.is_a?(Hash)
|
|
1269
|
+
new_data.each{ |k,v| @dslr.__weel_data[k] = v }
|
|
1270
|
+
end
|
|
1271
|
+
@dslr.__weel_data
|
|
1272
|
+
end # }}}
|
|
1273
|
+
def endpoints(new_endpoints=nil) # {{{
|
|
1274
|
+
unless new_endpoints.nil? || !new_endpoints.is_a?(Hash)
|
|
1275
|
+
new_endpoints.each{ |k,v| @dslr.__weel_endpoints[k] = v }
|
|
1276
|
+
end
|
|
1277
|
+
@dslr.__weel_endpoints
|
|
1278
|
+
end # }}}
|
|
1279
|
+
def endpoint(new_endpoints) # {{{
|
|
1280
|
+
unless new_endpoints.nil? || !new_endpoints.is_a?(Hash) || !new_endpoints.length == 1
|
|
1281
|
+
new_endpoints.each{ |k,v| @dslr.__weel_endpoints[k] = v }
|
|
1282
|
+
end
|
|
1283
|
+
nil
|
|
1284
|
+
end # }}}
|
|
1285
|
+
def status # {{{
|
|
1286
|
+
@dslr.__weel_status
|
|
1287
|
+
end # }}}
|
|
1288
|
+
|
|
1251
1289
|
# Stop the workflow execution
|
|
1252
1290
|
def stop # {{{
|
|
1253
1291
|
Thread.new do
|
|
@@ -18,6 +18,7 @@ class TestConnectionWrapper < WEEL::ConnectionWrapperBase
|
|
|
18
18
|
@__myhandler_position = position
|
|
19
19
|
@__myhandler_continue = continue
|
|
20
20
|
@__myhandler_returnValue = nil
|
|
21
|
+
@__myhandler_passthrough = nil
|
|
21
22
|
@t = nil
|
|
22
23
|
end
|
|
23
24
|
|
|
@@ -32,6 +33,10 @@ class TestConnectionWrapper < WEEL::ConnectionWrapperBase
|
|
|
32
33
|
$long_track << "CALL #{@__myhandler_position}: passthrough=[#{passthrough}], endpoint=[#{@__myhandler_endpoint}], parameters=[#{parameters.inspect}]\n"
|
|
33
34
|
$short_track << "C#{@__myhandler_position}"
|
|
34
35
|
|
|
36
|
+
if parameters[:async]
|
|
37
|
+
@__myhandler_passthrough = true
|
|
38
|
+
end
|
|
39
|
+
|
|
35
40
|
if @__myhandler_endpoint == 'stop it'
|
|
36
41
|
raise WEEL::Signal::Stop
|
|
37
42
|
end
|
|
@@ -76,7 +81,7 @@ class TestConnectionWrapper < WEEL::ConnectionWrapperBase
|
|
|
76
81
|
# information about how to continue the call. This passthrough-value is given
|
|
77
82
|
# to activity_handle if the workflow is configured to do so.
|
|
78
83
|
def activity_passthrough_value #{{{
|
|
79
|
-
|
|
84
|
+
@__myhandler_passthrough
|
|
80
85
|
end #}}}
|
|
81
86
|
|
|
82
87
|
# Called if the execution of the actual activity_handle is not necessary anymore
|
data/test/basic/tc_wf_control.rb
CHANGED
|
@@ -18,10 +18,10 @@ class TestWorkflowControl < Test::Unit::TestCase
|
|
|
18
18
|
assert(@wf.data[:x] == "begin_Handler_Dummy_Result_end", "Ending environment not correct, see result=#{@wf.data[:x].inspect}")
|
|
19
19
|
end
|
|
20
20
|
|
|
21
|
-
def
|
|
21
|
+
def test_stop_async
|
|
22
22
|
@wf.description do
|
|
23
23
|
call :a_test_1_1, :endpoint1
|
|
24
|
-
call :a_test_1_2, :endpoint1, parameters: { :call => Proc.new{ sleep 0.5 } }
|
|
24
|
+
call :a_test_1_2, :endpoint1, parameters: { :call => Proc.new{ sleep 0.5 }, :async => true }
|
|
25
25
|
call :a_test_1_3, :endpoint1
|
|
26
26
|
end
|
|
27
27
|
@wf.search WEEL::Position.new(:a_test_1_1, :at)
|
|
@@ -38,6 +38,27 @@ class TestWorkflowControl < Test::Unit::TestCase
|
|
|
38
38
|
assert(@wf.positions[0].position == :a_test_1_2, "Stop-position has wrong value: #{@wf.positions[0].position} instead of :a_test_2_1")
|
|
39
39
|
assert(@wf.positions[0].detail == :at, "Stop-Position is not :at")
|
|
40
40
|
end
|
|
41
|
+
|
|
42
|
+
def test_stop
|
|
43
|
+
@wf.description do
|
|
44
|
+
call :a_test_1_1, :endpoint1
|
|
45
|
+
call :a_test_1_2, :endpoint1, parameters: { :call => Proc.new{ sleep 0.5 } }
|
|
46
|
+
call :a_test_1_3, :endpoint1
|
|
47
|
+
end
|
|
48
|
+
@wf.search WEEL::Position.new(:a_test_1_1, :at)
|
|
49
|
+
wf = @wf.start
|
|
50
|
+
sleep(0.2)
|
|
51
|
+
@wf.stop.join
|
|
52
|
+
wf.join
|
|
53
|
+
wf_assert("DONE a_test_1_1")
|
|
54
|
+
wf_assert("STOPPED a_test_1_2")
|
|
55
|
+
wf_assert("DONE a_test_1_2",true)
|
|
56
|
+
wf_assert("CALL a_test_1_2:")
|
|
57
|
+
assert(@wf.state == :stopped, "Stopped workflow has wrong state, #{@wf.state} instead of :stopped")
|
|
58
|
+
assert(@wf.positions.is_a?(Array), "@wf.positions has wrong type, should be an array, it is: #{@wf.positions.inspect}")
|
|
59
|
+
assert(@wf.positions[0].position == :a_test_1_2, "Stop-position has wrong value: #{@wf.positions[0].position} instead of :a_test_2_1")
|
|
60
|
+
assert(@wf.positions[0].detail == :after, "Stop-Position is not :at")
|
|
61
|
+
end
|
|
41
62
|
# def test_continue
|
|
42
63
|
# @wf.description do
|
|
43
64
|
# call :a_test_1_1, :endpoint1
|
data/weel.gemspec
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
Gem::Specification.new do |s|
|
|
2
2
|
s.name = "weel"
|
|
3
|
-
s.version = "1.99.
|
|
3
|
+
s.version = "1.99.121"
|
|
4
4
|
s.platform = Gem::Platform::RUBY
|
|
5
|
-
s.license = "LGPL-3.0"
|
|
5
|
+
s.license = "LGPL-3.0-or-later"
|
|
6
6
|
s.summary = "Workflow Execution Engine Library (WEEL)"
|
|
7
7
|
|
|
8
8
|
s.description = "see http://cpee.org"
|
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.121
|
|
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: 2024-
|
|
12
|
+
date: 2024-09-13 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: test-unit
|
|
@@ -58,7 +58,6 @@ files:
|
|
|
58
58
|
- test/basic/tc_search.rb
|
|
59
59
|
- test/basic/tc_state.rb
|
|
60
60
|
- test/basic/tc_wf_control.rb
|
|
61
|
-
- test/basic/tc_wf_stop.rb
|
|
62
61
|
- test/complex/tc_generalsynchonizingmerge_loopsearch.rb
|
|
63
62
|
- test/complex/tc_parallel_stop.rb
|
|
64
63
|
- test/complexsearch/tc_search.rb
|
|
@@ -66,7 +65,6 @@ files:
|
|
|
66
65
|
- test/exec/tc_exec.rb
|
|
67
66
|
- test/speed/tc_speed1.rb
|
|
68
67
|
- test/speed/tc_speed2.rb
|
|
69
|
-
- test/test
|
|
70
68
|
- test/wfp_adv_branching/tc_generalizedjoin.rb
|
|
71
69
|
- test/wfp_adv_branching/tc_generalsynchronizingmerge.rb
|
|
72
70
|
- test/wfp_adv_branching/tc_localsynchronizingmerge.rb
|
|
@@ -85,7 +83,7 @@ files:
|
|
|
85
83
|
- weel.gemspec
|
|
86
84
|
homepage: http://cpee.org/
|
|
87
85
|
licenses:
|
|
88
|
-
- LGPL-3.0
|
|
86
|
+
- LGPL-3.0-or-later
|
|
89
87
|
metadata: {}
|
|
90
88
|
post_install_message:
|
|
91
89
|
rdoc_options: []
|
|
@@ -102,7 +100,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
102
100
|
- !ruby/object:Gem::Version
|
|
103
101
|
version: '0'
|
|
104
102
|
requirements: []
|
|
105
|
-
rubygems_version: 3.5.
|
|
103
|
+
rubygems_version: 3.5.11
|
|
106
104
|
signing_key:
|
|
107
105
|
specification_version: 4
|
|
108
106
|
summary: Workflow Execution Engine Library (WEEL)
|
|
@@ -113,7 +111,6 @@ test_files:
|
|
|
113
111
|
- test/TestConnectionWrapper.rb
|
|
114
112
|
- test/TestMixin.rb
|
|
115
113
|
- test/TestWorkflow.rb
|
|
116
|
-
- test/test
|
|
117
114
|
- test/basic/tc_choose.rb
|
|
118
115
|
- test/basic/tc_codereplace.rb
|
|
119
116
|
- test/basic/tc_data.rb
|
|
@@ -123,7 +120,6 @@ test_files:
|
|
|
123
120
|
- test/basic/tc_search.rb
|
|
124
121
|
- test/basic/tc_state.rb
|
|
125
122
|
- test/basic/tc_wf_control.rb
|
|
126
|
-
- test/basic/tc_wf_stop.rb
|
|
127
123
|
- test/complex/tc_generalsynchonizingmerge_loopsearch.rb
|
|
128
124
|
- test/complex/tc_parallel_stop.rb
|
|
129
125
|
- test/complexsearch/tc_search.rb
|
data/test/basic/tc_wf_stop.rb
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
require 'test/unit'
|
|
2
|
-
require File.expand_path(::File.dirname(__FILE__) + '/../TestWorkflow')
|
|
3
|
-
|
|
4
|
-
class TestWorkflowControl < Test::Unit::TestCase
|
|
5
|
-
include TestMixin
|
|
6
|
-
|
|
7
|
-
def test_stop
|
|
8
|
-
@wf.description do
|
|
9
|
-
call :a_test_1_1, :endpoint1
|
|
10
|
-
call :a_test_1_2, :endpoint1, parameters: { :call => Proc.new{ sleep 0.5 } }
|
|
11
|
-
call :a_test_1_3, :endpoint1
|
|
12
|
-
end
|
|
13
|
-
@wf.search WEEL::Position.new(:a_test_1_1, :at)
|
|
14
|
-
wf = @wf.start
|
|
15
|
-
sleep(0.2)
|
|
16
|
-
@wf.stop.join
|
|
17
|
-
wf.join
|
|
18
|
-
wf_assert("DONE a_test_1_1")
|
|
19
|
-
wf_assert("STOPPED a_test_1_2")
|
|
20
|
-
wf_assert("DONE a_test_1_2")
|
|
21
|
-
wf_assert("CALL a_test_1_2:")
|
|
22
|
-
assert(@wf.state == :stopped, "Stopped workflow has wrong state, #{@wf.state} instead of :stopped")
|
|
23
|
-
assert(@wf.positions.is_a?(Array), "@wf.positions has wrong type, should be an array, it is: #{@wf.positions.inspect}")
|
|
24
|
-
assert(@wf.positions[0].position == :a_test_1_2, "Stop-position has wrong value: #{@wf.positions[0].position} instead of :a_test_2_1")
|
|
25
|
-
assert(@wf.positions[0].detail == :after, "Stop-Position is not :at")
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
def test_stops
|
|
29
|
-
1.upto 1000 do |i|
|
|
30
|
-
puts '.'
|
|
31
|
-
test_stop
|
|
32
|
-
end
|
|
33
|
-
end
|
|
34
|
-
end
|
data/test/test
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
ruby basic/tc_choose.rb
|
|
2
|
-
ruby basic/tc_codereplace.rb
|
|
3
|
-
ruby basic/tc_data.rb
|
|
4
|
-
ruby basic/tc_endpoint.rb
|
|
5
|
-
ruby basic/tc_handler.rb
|
|
6
|
-
ruby basic/tc_parallel.rb
|
|
7
|
-
ruby basic/tc_search.rb
|
|
8
|
-
ruby basic/tc_state.rb
|
|
9
|
-
ruby basic/tc_wf_control.rb
|
|
10
|
-
ruby complexsearch/tc_search.rb
|
|
11
|
-
ruby complex/tc_generalsynchonizingmerge_loopsearch.rb
|
|
12
|
-
ruby complex/tc_parallel_stop.rb
|
|
13
|
-
ruby exec/tc_again.rb
|
|
14
|
-
ruby exec/tc_exec.rb
|
|
15
|
-
ruby simulation/dl.rb
|
|
16
|
-
ruby simulation/tt_permutationtester.rb
|
|
17
|
-
ruby simulation/tt_sim_activity.rb
|
|
18
|
-
ruby simulation/tt_sim_choose1.rb
|
|
19
|
-
ruby simulation/tt_sim_choose2.rb
|
|
20
|
-
ruby simulation/tt_sim_loop_parallel_choose.rb
|
|
21
|
-
ruby simulation/tt_sim_loop_parallel.rb
|
|
22
|
-
ruby simulation/tt_sim_loop.rb
|
|
23
|
-
ruby speed/tc_speed1.rb
|
|
24
|
-
ruby speed/tc_speed2.rb
|
|
25
|
-
ruby wfp_adv_branching/tc_generalizedjoin.rb
|
|
26
|
-
ruby wfp_adv_branching/tc_generalsynchronizingmerge.rb
|
|
27
|
-
ruby wfp_adv_branching/tc_localsynchronizingmerge.rb
|
|
28
|
-
ruby wfp_adv_branching/tc_multichoice_structuredsynchronizingmerge.rb
|
|
29
|
-
ruby wfp_adv_branching/tc_multimerge.rb
|
|
30
|
-
ruby wfp_adv_branching/tc_structured_discriminator.rb
|
|
31
|
-
ruby wfp_adv_branching/tc_structured_partial_join.rb
|
|
32
|
-
ruby wfp_adv_branching/tc_threadmerge.rb
|
|
33
|
-
ruby wfp_adv_branching/tc_threadsplit.rb
|
|
34
|
-
ruby wfp_basic/tc_exclusivechoice_simplemerge.rb
|
|
35
|
-
ruby wfp_basic/tc_parallelsplit_synchronization.rb
|
|
36
|
-
ruby wfp_basic/tc_sequence.rb
|
|
37
|
-
ruby wfp_iteration/tc_structuredloop.rb
|
|
38
|
-
ruby wfp_state_based/tc_deferredchoice.rb
|
|
39
|
-
ruby wfp_state_based/tc_interleavedparallelrouting.rb
|