weel 1.99.132 → 1.99.137
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 +81 -32
- data/weel.gemspec +1 -1
- metadata +3 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6e69e303c897530d826b19a2320237f9da49ae0bd439753f537be6fb09b3912c
|
4
|
+
data.tar.gz: 27eedad489106b5bde12a0b8d087cc83fbb51cdc72a23ddce4d9ff95750f6cb3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 54f28321d913e20feb88aa6a8811f7c05ffe59a1e91fc74c08c4c32370aee717ca83a79a3d54d293431cb2c6d60ed1c29dc6cd31df9c99464e1593124c7f0eac
|
7
|
+
data.tar.gz: e92639b7f8d66fbbc5fdc7d6db781282a8d2bca059e2db4fbbd6cc8adf13fc2cb02165b65007ecbf31c473456242ca546a4df99c86c1fac33b8d126aad473f60
|
data/lib/weel.rb
CHANGED
@@ -241,20 +241,11 @@ class WEEL
|
|
241
241
|
def initialize(id,message)
|
242
242
|
@id = id
|
243
243
|
@message = message
|
244
|
-
@nudge = Queue.new
|
245
244
|
end
|
246
245
|
def update(id,message)
|
247
246
|
@id = id
|
248
247
|
@message = message
|
249
248
|
end
|
250
|
-
def nudge!
|
251
|
-
1.upto(@nudge.num_waiting) do
|
252
|
-
@nudge.push(nil)
|
253
|
-
end
|
254
|
-
end
|
255
|
-
def wait_until_nudged!
|
256
|
-
@nudge.pop
|
257
|
-
end
|
258
249
|
def to_json(*a)
|
259
250
|
{
|
260
251
|
'id' => @id,
|
@@ -498,8 +489,8 @@ class WEEL
|
|
498
489
|
# position: a unique identifier within the wf-description (may be used by the search to identify a starting point)
|
499
490
|
# endpoint: (only with :call) ep of the service
|
500
491
|
# parameters: (only with :call) service parameters
|
501
|
-
def call(position, endpoint, parameters: {}, finalize: nil, update: nil, prepare: nil, salvage: nil, &finalizeblk) #{{{
|
502
|
-
__weel_activity(position,:call,endpoint,parameters,finalize||finalizeblk,update,prepare,salvage)
|
492
|
+
def call(position, endpoint, parameters: {}, signal: false, finalize: nil, update: nil, prepare: nil, salvage: nil, &finalizeblk) #{{{
|
493
|
+
__weel_activity(position,:call,endpoint,parameters,finalize||finalizeblk,update,prepare,salvage,signal)
|
503
494
|
end #}}}
|
504
495
|
# when two params, second param always script
|
505
496
|
# when block and two params, parameters stays
|
@@ -521,6 +512,7 @@ class WEEL
|
|
521
512
|
Thread.current[:branch_traces_ids] = 0
|
522
513
|
Thread.current[:branch_finished_count] = 0
|
523
514
|
Thread.current[:branch_event] = Continue.new
|
515
|
+
Thread.current[:nudge] = Queue.new
|
524
516
|
Thread.current[:mutex] = Mutex.new
|
525
517
|
|
526
518
|
__weel_protect_yield(&block)
|
@@ -562,7 +554,7 @@ class WEEL
|
|
562
554
|
end # }}}
|
563
555
|
|
564
556
|
# Defines a branch of a parallel-Construct
|
565
|
-
def parallel_branch(data=@__weel_data,&block)# {{
|
557
|
+
def parallel_branch(data=@__weel_data,&block)# {{
|
566
558
|
return if self.__weel_state == :stopping || self.__weel_state == :finishing || self.__weel_state == :stopped || Thread.current[:nolongernecessary]
|
567
559
|
branch_parent = Thread.current
|
568
560
|
|
@@ -599,6 +591,9 @@ class WEEL
|
|
599
591
|
branch_parent[:branches].each do |thread|
|
600
592
|
if thread.alive? && thread[:branch_wait_count_cancel_active] == false
|
601
593
|
thread[:nolongernecessary] = true
|
594
|
+
1.upto(branch_parent[:nudge].num_waiting) do
|
595
|
+
branch_parent[:nudge].push(nil)
|
596
|
+
end
|
602
597
|
__weel_recursive_continue(thread)
|
603
598
|
end
|
604
599
|
end
|
@@ -666,6 +661,40 @@ class WEEL
|
|
666
661
|
__weel_protect_yield(&block) if __weel_is_in_search_mode || !Thread.current[:alternative_executed].last
|
667
662
|
end # }}}
|
668
663
|
|
664
|
+
def wait_for_signal(position,label) #{{{
|
665
|
+
position = __weel_position_test position
|
666
|
+
searchmode = __weel_is_in_search_mode(position)
|
667
|
+
|
668
|
+
return if searchmode
|
669
|
+
return if self.__weel_state == :stopping || self.__weel_state == :finishing || self.__weel_state == :stopped || Thread.current[:nolongernecessary]
|
670
|
+
|
671
|
+
# gather traces in threads to point to join
|
672
|
+
if Thread.current[:branch_parent] && Thread.current[:branch_traces_id]
|
673
|
+
Thread.current[:branch_parent][:branch_traces][Thread.current[:branch_traces_id]] ||= []
|
674
|
+
Thread.current[:branch_parent][:branch_traces][Thread.current[:branch_traces_id]] << position
|
675
|
+
end
|
676
|
+
|
677
|
+
uuid = SecureRandom.uuid
|
678
|
+
wp = __weel_progress position, SecureRandom.uuid
|
679
|
+
|
680
|
+
@__weel_connectionwrapper::inform_activity_minimal @__weel_connectionwrapper_args,'calling',uuid,label,position
|
681
|
+
|
682
|
+
Thread.current[:branch_parent][:nudge].pop
|
683
|
+
|
684
|
+
if self.__weel_state != :stopping
|
685
|
+
if Thread.current[:nolongernecessary]
|
686
|
+
@__weel_connectionwrapper::inform_activity_minimal('done', uuid, label, position)
|
687
|
+
Thread.current[:branch_position] = nil
|
688
|
+
@__weel_positions.delete wp
|
689
|
+
@__weel_connectionwrapper::inform_position_change @__weel_connectionwrapper_args, :unmark => [wp]
|
690
|
+
else
|
691
|
+
@__weel_connectionwrapper::inform_activity_minimal @__weel_connectionwrapper_args, 'done', uuid, label, position
|
692
|
+
end
|
693
|
+
end
|
694
|
+
|
695
|
+
__weel_activity_ensure
|
696
|
+
end #}}}
|
697
|
+
|
669
698
|
# Defines a critical block (=Mutex)
|
670
699
|
def critical(id,&block)# {{{
|
671
700
|
return if self.__weel_state == :stopping || self.__weel_state == :finishing || self.__weel_state == :stopped || Thread.current[:nolongernecessary]
|
@@ -779,10 +808,13 @@ class WEEL
|
|
779
808
|
connectionwrapper = @__weel_connectionwrapper.new @__weel_connectionwrapper_args
|
780
809
|
connectionwrapper.test_condition(@__weel_data,@__weel_endpoints,Thread.current[:local],connectionwrapper.additional,condition,args)
|
781
810
|
rescue NameError => err # don't look into it, or it will explode
|
782
|
-
# if you access $! here, BOOOM
|
783
811
|
self.__weel_state = :stopping
|
784
812
|
@__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)
|
785
813
|
nil
|
814
|
+
rescue WEEL::Signal::Error => err
|
815
|
+
self.__weel_state = :stopping
|
816
|
+
@__weel_connectionwrapper::inform_syntax_error(@__weel_connectionwrapper_args,err,nil)
|
817
|
+
nil
|
786
818
|
rescue => err
|
787
819
|
self.__weel_state = :stopping
|
788
820
|
@__weel_connectionwrapper::inform_syntax_error(@__weel_connectionwrapper_args,err,nil)
|
@@ -827,7 +859,7 @@ class WEEL
|
|
827
859
|
wp
|
828
860
|
end #}}}
|
829
861
|
|
830
|
-
def __weel_activity(position, type, endpoint, parameters, finalize=nil, update=nil, prepare=nil, salvage=nil)# {{{
|
862
|
+
def __weel_activity(position, type, endpoint, parameters, finalize=nil, update=nil, prepare=nil, salvage=nil, signal=false)# {{{
|
831
863
|
position = __weel_position_test position
|
832
864
|
searchmode = __weel_is_in_search_mode(position)
|
833
865
|
return if searchmode == true
|
@@ -854,6 +886,11 @@ class WEEL
|
|
854
886
|
connectionwrapper.activity_manipulate_handle(parameters)
|
855
887
|
connectionwrapper.inform_activity_manipulate
|
856
888
|
struct = connectionwrapper.manipulate(false,@__weel_lock,@__weel_data,@__weel_endpoints,@__weel_status,Thread.current[:local],connectionwrapper.additional,finalize,'Activity ' + position.to_s)
|
889
|
+
if signal
|
890
|
+
1.upto(Thread.current[:branch_parent][:nudge].num_waiting) do
|
891
|
+
Thread.current[:branch_parent][:nudge].push(nil)
|
892
|
+
end
|
893
|
+
end
|
857
894
|
connectionwrapper.inform_manipulate_change(
|
858
895
|
((struct && struct.changed_status) ? @__weel_status : nil),
|
859
896
|
((struct && struct.changed_data.any?) ? struct.changed_data.uniq : nil),
|
@@ -919,6 +956,11 @@ class WEEL
|
|
919
956
|
struct = connectionwrapper.manipulate(false,@__weel_lock,@__weel_data,@__weel_endpoints,@__weel_status,Thread.current[:local],connectionwrapper.additional,code,'Activity ' + position.to_s + ' ' + cmess,connectionwrapper.activity_result_value,connectionwrapper.activity_result_options)
|
920
957
|
Signal::Proceed
|
921
958
|
end
|
959
|
+
if signal
|
960
|
+
1.upto(Thread.current[:branch_parent][:nudge].num_waiting) do
|
961
|
+
Thread.current[:branch_parent][:nudge].push(nil)
|
962
|
+
end
|
963
|
+
end
|
922
964
|
connectionwrapper.inform_manipulate_change(
|
923
965
|
((struct && struct.changed_status) ? @__weel_status : nil),
|
924
966
|
((struct && struct.changed_data.any?) ? struct.changed_data.uniq : nil),
|
@@ -927,8 +969,6 @@ class WEEL
|
|
927
969
|
@__weel_endpoints
|
928
970
|
)
|
929
971
|
throw(Signal::Again, Signal::Again) if ma.nil? || ma == Signal::Again # this signal again loops "there is a catch" because rescue signal throw that throughly restarts the task
|
930
|
-
else
|
931
|
-
|
932
972
|
end
|
933
973
|
end while waitingresult == Signal::UpdateAgain # this signal again loops because async update, proposal: rename to UpdateAgain
|
934
974
|
if connectionwrapper.activity_passthrough_value.nil?
|
@@ -947,6 +987,7 @@ class WEEL
|
|
947
987
|
wp.detail = :unmark
|
948
988
|
end
|
949
989
|
rescue Signal::NoLongerNecessary
|
990
|
+
connectionwrapper.activity_stop
|
950
991
|
connectionwrapper.inform_activity_cancelled
|
951
992
|
connectionwrapper.inform_activity_done
|
952
993
|
@__weel_positions.delete wp
|
@@ -965,27 +1006,31 @@ class WEEL
|
|
965
1006
|
@__weel_connectionwrapper::inform_connectionwrapper_error @__weel_connectionwrapper_args, err
|
966
1007
|
self.__weel_state = :stopping
|
967
1008
|
ensure
|
968
|
-
|
969
|
-
|
970
|
-
|
971
|
-
|
972
|
-
|
973
|
-
|
974
|
-
|
975
|
-
|
976
|
-
|
977
|
-
|
978
|
-
|
979
|
-
|
980
|
-
|
981
|
-
|
1009
|
+
__weel_activity_ensure connectionwrapper
|
1010
|
+
end
|
1011
|
+
end # }}}
|
1012
|
+
|
1013
|
+
def __weel_activity_ensure(connectionwrapper=nil) #{{{
|
1014
|
+
connectionwrapper.mem_guard unless connectionwrapper.nil?
|
1015
|
+
if Thread.current[:branch_parent]
|
1016
|
+
Thread.current[:branch_parent][:mutex].synchronize do
|
1017
|
+
if Thread.current[:branch_parent][:branch_wait_count_cancel_condition] == :first
|
1018
|
+
if !Thread.current[:branch_wait_count_cancel_active] && Thread.current[:branch_parent][:branch_wait_count_cancel] < Thread.current[:branch_parent][:branch_wait_count]
|
1019
|
+
Thread.current[:branch_wait_count_cancel_active] = true
|
1020
|
+
Thread.current[:branch_parent][:branch_wait_count_cancel] += 1
|
1021
|
+
end
|
1022
|
+
if Thread.current[:branch_parent][:branch_wait_count_cancel] == Thread.current[:branch_parent][:branch_wait_count] && self.__weel_state != :stopping && self.__weel_state != :finishing
|
1023
|
+
Thread.current[:branch_parent][:branches].each do |thread|
|
1024
|
+
if thread.alive? && thread[:branch_wait_count_cancel_active] == false
|
1025
|
+
thread[:nolongernecessary] = true
|
1026
|
+
__weel_recursive_continue(thread)
|
982
1027
|
end
|
983
1028
|
end
|
984
1029
|
end
|
985
1030
|
end
|
986
1031
|
end
|
987
|
-
Thread.current[:continue].clear if Thread.current[:continue] && Thread.current[:continue].is_a?(Continue)
|
988
1032
|
end
|
1033
|
+
Thread.current[:continue].clear if Thread.current[:continue] && Thread.current[:continue].is_a?(Continue)
|
989
1034
|
end # }}}
|
990
1035
|
|
991
1036
|
def __weel_recursive_print(thread,indent='')# {{{
|
@@ -997,6 +1042,11 @@ class WEEL
|
|
997
1042
|
end # }}}
|
998
1043
|
def __weel_recursive_continue(thread)# {{{
|
999
1044
|
return unless thread
|
1045
|
+
if thread[:nudge]
|
1046
|
+
1.upto(thread[:nudge].num_waiting) do
|
1047
|
+
thread[:nudge].push(nil)
|
1048
|
+
end
|
1049
|
+
end
|
1000
1050
|
if thread.alive? && thread[:continue]
|
1001
1051
|
thread[:continue].continue
|
1002
1052
|
end
|
@@ -1065,7 +1115,6 @@ class WEEL
|
|
1065
1115
|
@__weel_state = newState
|
1066
1116
|
|
1067
1117
|
if newState == :stopping || newState == :finishing
|
1068
|
-
@__weel_status.nudge!
|
1069
1118
|
__weel_recursive_continue(@__weel_main)
|
1070
1119
|
end
|
1071
1120
|
|
data/weel.gemspec
CHANGED
metadata
CHANGED
@@ -1,15 +1,14 @@
|
|
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.137
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Juergen eTM Mangler
|
8
8
|
- Gerhard Stuermer
|
9
|
-
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: test-unit
|
@@ -85,7 +84,6 @@ homepage: http://cpee.org/
|
|
85
84
|
licenses:
|
86
85
|
- LGPL-3.0-or-later
|
87
86
|
metadata: {}
|
88
|
-
post_install_message:
|
89
87
|
rdoc_options: []
|
90
88
|
require_paths:
|
91
89
|
- lib
|
@@ -100,8 +98,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
100
98
|
- !ruby/object:Gem::Version
|
101
99
|
version: '0'
|
102
100
|
requirements: []
|
103
|
-
rubygems_version: 3.
|
104
|
-
signing_key:
|
101
|
+
rubygems_version: 3.6.9
|
105
102
|
specification_version: 4
|
106
103
|
summary: Workflow Execution Engine Library (WEEL)
|
107
104
|
test_files:
|