weel 1.99.134 → 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 +76 -31
- data/weel.gemspec +1 -1
- metadata +3 -3
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]
|
@@ -830,7 +859,7 @@ class WEEL
|
|
830
859
|
wp
|
831
860
|
end #}}}
|
832
861
|
|
833
|
-
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)# {{{
|
834
863
|
position = __weel_position_test position
|
835
864
|
searchmode = __weel_is_in_search_mode(position)
|
836
865
|
return if searchmode == true
|
@@ -857,6 +886,11 @@ class WEEL
|
|
857
886
|
connectionwrapper.activity_manipulate_handle(parameters)
|
858
887
|
connectionwrapper.inform_activity_manipulate
|
859
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
|
860
894
|
connectionwrapper.inform_manipulate_change(
|
861
895
|
((struct && struct.changed_status) ? @__weel_status : nil),
|
862
896
|
((struct && struct.changed_data.any?) ? struct.changed_data.uniq : nil),
|
@@ -922,6 +956,11 @@ class WEEL
|
|
922
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)
|
923
957
|
Signal::Proceed
|
924
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
|
925
964
|
connectionwrapper.inform_manipulate_change(
|
926
965
|
((struct && struct.changed_status) ? @__weel_status : nil),
|
927
966
|
((struct && struct.changed_data.any?) ? struct.changed_data.uniq : nil),
|
@@ -930,8 +969,6 @@ class WEEL
|
|
930
969
|
@__weel_endpoints
|
931
970
|
)
|
932
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
|
933
|
-
else
|
934
|
-
|
935
972
|
end
|
936
973
|
end while waitingresult == Signal::UpdateAgain # this signal again loops because async update, proposal: rename to UpdateAgain
|
937
974
|
if connectionwrapper.activity_passthrough_value.nil?
|
@@ -969,27 +1006,31 @@ class WEEL
|
|
969
1006
|
@__weel_connectionwrapper::inform_connectionwrapper_error @__weel_connectionwrapper_args, err
|
970
1007
|
self.__weel_state = :stopping
|
971
1008
|
ensure
|
972
|
-
|
973
|
-
|
974
|
-
|
975
|
-
|
976
|
-
|
977
|
-
|
978
|
-
|
979
|
-
|
980
|
-
|
981
|
-
|
982
|
-
|
983
|
-
|
984
|
-
|
985
|
-
|
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)
|
986
1027
|
end
|
987
1028
|
end
|
988
1029
|
end
|
989
1030
|
end
|
990
1031
|
end
|
991
|
-
Thread.current[:continue].clear if Thread.current[:continue] && Thread.current[:continue].is_a?(Continue)
|
992
1032
|
end
|
1033
|
+
Thread.current[:continue].clear if Thread.current[:continue] && Thread.current[:continue].is_a?(Continue)
|
993
1034
|
end # }}}
|
994
1035
|
|
995
1036
|
def __weel_recursive_print(thread,indent='')# {{{
|
@@ -1001,6 +1042,11 @@ class WEEL
|
|
1001
1042
|
end # }}}
|
1002
1043
|
def __weel_recursive_continue(thread)# {{{
|
1003
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
|
1004
1050
|
if thread.alive? && thread[:continue]
|
1005
1051
|
thread[:continue].continue
|
1006
1052
|
end
|
@@ -1069,7 +1115,6 @@ class WEEL
|
|
1069
1115
|
@__weel_state = newState
|
1070
1116
|
|
1071
1117
|
if newState == :stopping || newState == :finishing
|
1072
|
-
@__weel_status.nudge!
|
1073
1118
|
__weel_recursive_continue(@__weel_main)
|
1074
1119
|
end
|
1075
1120
|
|
data/weel.gemspec
CHANGED
metadata
CHANGED
@@ -1,14 +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
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: test-unit
|
@@ -98,7 +98,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
98
98
|
- !ruby/object:Gem::Version
|
99
99
|
version: '0'
|
100
100
|
requirements: []
|
101
|
-
rubygems_version: 3.6.
|
101
|
+
rubygems_version: 3.6.9
|
102
102
|
specification_version: 4
|
103
103
|
summary: Workflow Execution Engine Library (WEEL)
|
104
104
|
test_files:
|