weel 1.1.1 → 1.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Changelog +5 -0
- data/lib/weel.rb +12 -15
- data/test/SimHandlerWrapper.rb +47 -5
- data/test/basic/tc_parallel.rb +1 -0
- data/test/basic/tc_state.rb +5 -5
- data/test/wfp_adv_branching/tc_structured_discriminator.rb +1 -0
- data/test/wfp_state_based/tc_deferredchoice.rb +4 -2
- data/weel.gemspec +5 -10
- metadata +48 -59
data/Changelog
CHANGED
data/lib/weel.rb
CHANGED
@@ -194,19 +194,19 @@ class WEEL
|
|
194
194
|
|
195
195
|
class Continue #{{{
|
196
196
|
def initialize
|
197
|
-
@
|
197
|
+
@q = Queue.new
|
198
|
+
@m = Mutex.new
|
198
199
|
end
|
199
200
|
def waiting?
|
200
|
-
@
|
201
|
+
@m.synchronize do
|
202
|
+
!@q.empty?
|
203
|
+
end
|
201
204
|
end
|
202
205
|
def continue
|
203
|
-
|
204
|
-
Thread.pass
|
205
|
-
end
|
206
|
-
@thread.wakeup if @thread.alive?
|
206
|
+
@q.push nil
|
207
207
|
end
|
208
208
|
def wait
|
209
|
-
@
|
209
|
+
@q.deq
|
210
210
|
end
|
211
211
|
end #}}}
|
212
212
|
|
@@ -525,9 +525,9 @@ class WEEL
|
|
525
525
|
Thread.current[:alternative_mode] ||= []
|
526
526
|
Thread.current[:alternative_executed] << false
|
527
527
|
Thread.current[:alternative_mode] << mode
|
528
|
-
hw, pos = __weel_sim_start(:choose,:mode => Thread.current[:alternative_mode]) if __weel_sim
|
528
|
+
hw, pos = __weel_sim_start(:choose,:mode => Thread.current[:alternative_mode].last) if __weel_sim
|
529
529
|
yield
|
530
|
-
__weel_sim_stop(:choose,hw,pos,:mode => Thread.current[:alternative_mode]) if __weel_sim
|
530
|
+
__weel_sim_stop(:choose,hw,pos,:mode => Thread.current[:alternative_mode].last) if __weel_sim
|
531
531
|
Thread.current[:alternative_executed].pop
|
532
532
|
Thread.current[:alternative_mode].pop
|
533
533
|
nil
|
@@ -620,15 +620,12 @@ class WEEL
|
|
620
620
|
end # }}}
|
621
621
|
def __weel_recursive_continue(thread)# {{{
|
622
622
|
return unless thread
|
623
|
-
if thread.alive? && thread[:continue]
|
623
|
+
if thread.alive? && thread[:continue]
|
624
624
|
thread[:continue].continue
|
625
625
|
end
|
626
|
-
if thread.alive? && thread[:branch_event]
|
626
|
+
if thread.alive? && thread[:branch_event]
|
627
627
|
thread[:mutex].synchronize do
|
628
|
-
unless thread[:branch_event].nil?
|
629
|
-
thread[:branch_event].continue
|
630
|
-
# thread[:branch_event] = nil
|
631
|
-
end
|
628
|
+
thread[:branch_event].continue unless thread[:branch_event].nil?
|
632
629
|
end
|
633
630
|
end
|
634
631
|
if thread[:branches]
|
data/test/SimHandlerWrapper.rb
CHANGED
@@ -51,6 +51,50 @@ class Trace #{{{
|
|
51
51
|
nil
|
52
52
|
end
|
53
53
|
|
54
|
+
def generate_list
|
55
|
+
pp self
|
56
|
+
pp recursive_generate_list(self,:otherwise=>false)
|
57
|
+
end
|
58
|
+
|
59
|
+
def recursive_generate_list(container,options)
|
60
|
+
traces = [[]]
|
61
|
+
container.each do |ele|
|
62
|
+
case ele
|
63
|
+
when TraceActivity
|
64
|
+
traces.last << ele.tid
|
65
|
+
when TraceChoose
|
66
|
+
options[:otherwise] = true
|
67
|
+
tmp = recursive_generate_list(ele,options)
|
68
|
+
options[:otherwise] = false
|
69
|
+
add_traces(traces,tmp)
|
70
|
+
|
71
|
+
#tmp = recursive_generate_list(ele,options)
|
72
|
+
when TraceAlternative
|
73
|
+
next if options[:otherwise]
|
74
|
+
tmp = recursive_generate_list(ele,options)
|
75
|
+
add_traces(traces,tmp)
|
76
|
+
when TraceOtherwise
|
77
|
+
next unless options[:otherwise]
|
78
|
+
options[:otherwise] = false
|
79
|
+
tmp = recursive_generate_list(ele,options)
|
80
|
+
p tmp
|
81
|
+
p '---'
|
82
|
+
add_traces(traces,tmp)
|
83
|
+
options[:otherwise] = true
|
84
|
+
end
|
85
|
+
end
|
86
|
+
traces
|
87
|
+
end
|
88
|
+
|
89
|
+
def add_traces(before,newones)
|
90
|
+
before.each do |trc|
|
91
|
+
newones.each do |no|
|
92
|
+
p trc
|
93
|
+
trc += no
|
94
|
+
end
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
54
98
|
private :recursive_get_container
|
55
99
|
end #}}}
|
56
100
|
|
@@ -74,7 +118,7 @@ class TraceContainer < TraceBase #{{{
|
|
74
118
|
def close!; @open = false; end
|
75
119
|
end #}}}
|
76
120
|
|
77
|
-
class
|
121
|
+
class TraceActivity < TraceBase #{{{
|
78
122
|
attr_accessor :item
|
79
123
|
def initialize(tid, item)
|
80
124
|
super tid
|
@@ -107,8 +151,6 @@ class PlainTrace
|
|
107
151
|
end
|
108
152
|
end
|
109
153
|
|
110
|
-
$trace = Trace.new
|
111
|
-
|
112
154
|
class SimHandlerWrapper < WEEL::HandlerWrapperBase
|
113
155
|
def initialize(args,endpoint=nil,position=nil,continue=nil)
|
114
156
|
@__myhandler_stopped = false
|
@@ -119,11 +161,11 @@ class SimHandlerWrapper < WEEL::HandlerWrapperBase
|
|
119
161
|
end
|
120
162
|
|
121
163
|
def simulate(type,nesting,tid,parent,parameters={})
|
122
|
-
pp "#{type} - #{nesting} - #{tid} - #{parent} - #{parameters.inspect}"
|
164
|
+
# pp "#{type} - #{nesting} - #{tid} - #{parent} - #{parameters.inspect}"
|
123
165
|
|
124
166
|
case type
|
125
167
|
when :activity
|
126
|
-
$trace.get_container(parent) <<
|
168
|
+
$trace.get_container(parent) << TraceActivity.new(tid,parameters[:endpoint])
|
127
169
|
when :parallel
|
128
170
|
simulate_add_to_container($trace,nesting,parent,tid) { TraceParallel.new(tid) }
|
129
171
|
when :loop
|
data/test/basic/tc_parallel.rb
CHANGED
data/test/basic/tc_state.rb
CHANGED
@@ -4,11 +4,11 @@ require File.expand_path(::File.dirname(__FILE__) + '/../TestWorkflow')
|
|
4
4
|
class TestState < Test::Unit::TestCase
|
5
5
|
include TestMixin
|
6
6
|
|
7
|
-
def test_check_state
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
end
|
7
|
+
#def test_check_state
|
8
|
+
# s = @wf.state
|
9
|
+
# assert(s.is_a?(Symbol), "state is not a symbol")
|
10
|
+
# assert(s == :ready, "state is not set to :ready, it is #{s}")
|
11
|
+
#end
|
12
12
|
def test_check_stop_state
|
13
13
|
@wf.start
|
14
14
|
@wf.stop.join
|
@@ -12,6 +12,7 @@ class TestWFPDeferredChoice < Test::Unit::TestCase
|
|
12
12
|
activity :a1_1, :call, :endpoint1 do
|
13
13
|
data.choice = 1
|
14
14
|
end
|
15
|
+
Thread.pass
|
15
16
|
end
|
16
17
|
parallel_branch do
|
17
18
|
activity(:a1_2, :call, :endpoint1, :call => Proc.new{sleep 1.0}) do
|
@@ -30,8 +31,9 @@ class TestWFPDeferredChoice < Test::Unit::TestCase
|
|
30
31
|
end
|
31
32
|
@wf.start.join
|
32
33
|
wf_assert('CALL a1_1')
|
33
|
-
wf_assert('
|
34
|
-
|
34
|
+
wf_assert('DONE a1_1')
|
35
|
+
wf_assert('MANIPULATE a1_1')
|
36
|
+
wf_sassert('NLNa1_2Ca2_1Da2_1|finished|')
|
35
37
|
data = @wf.data
|
36
38
|
assert(data[:choice] == 1, "data[:choice] has not the correct value [#{data[:x]}]")
|
37
39
|
end
|
data/weel.gemspec
CHANGED
@@ -1,18 +1,13 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = "weel"
|
3
|
-
s.version = "1.
|
3
|
+
s.version = "1.2.1"
|
4
4
|
s.platform = Gem::Platform::RUBY
|
5
|
-
s.
|
5
|
+
s.license = "LGPL-2"
|
6
|
+
s.summary = "Preliminary release of the Workflow Execution Engine Library (WEEL)"
|
6
7
|
|
7
|
-
s.description
|
8
|
-
For WEE Library specific information see http://cpee.org/.
|
8
|
+
s.description = "Workflow Execution Engine Library (WEEL)"
|
9
9
|
|
10
|
-
|
11
|
-
|
12
|
-
WEE Library is freely distributable according to the terms of the GNU Lesser General Public License (see the file 'COPYING').
|
13
|
-
|
14
|
-
This program is distributed without any warranty. See the file 'COPYING' for details.
|
15
|
-
EOF
|
10
|
+
s.required_ruby_version = '>=1.9.3'
|
16
11
|
|
17
12
|
s.files = Dir['{example/**/*,lib/weel.rb}'] + %w(COPYING Changelog FEATURES INSTALL Rakefile weel.gemspec README AUTHORS)
|
18
13
|
s.require_path = 'lib'
|
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.
|
4
|
+
version: 1.2.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,21 +10,9 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2013-
|
13
|
+
date: 2013-06-21 00:00:00.000000000 Z
|
14
14
|
dependencies: []
|
15
|
-
description:
|
16
|
-
|
17
|
-
|
18
|
-
Copyright (C) 2008-2013 Jürgen Mangler <juergen.mangler@gmail.com> and others.
|
19
|
-
|
20
|
-
|
21
|
-
WEE Library is freely distributable according to the terms of the GNU Lesser General
|
22
|
-
Public License (see the file ''COPYING'').
|
23
|
-
|
24
|
-
|
25
|
-
This program is distributed without any warranty. See the file ''COPYING'' for details.
|
26
|
-
|
27
|
-
'
|
15
|
+
description: Workflow Execution Engine Library (WEEL)
|
28
16
|
email: juergen.mangler@gmail.com
|
29
17
|
executables: []
|
30
18
|
extensions: []
|
@@ -46,36 +34,37 @@ files:
|
|
46
34
|
- test/SimHandlerWrapper.rb
|
47
35
|
- test/TestHandlerWrapper.rb
|
48
36
|
- test/ContinueTest.rb
|
49
|
-
- test/TestMixin.rb
|
50
37
|
- test/TestWorkflow.rb
|
51
|
-
- test/
|
38
|
+
- test/TestMixin.rb
|
39
|
+
- test/wfp_basic/tc_exclusivechoice_simplemerge.rb
|
40
|
+
- test/wfp_basic/tc_parallelsplit_synchronization.rb
|
41
|
+
- test/wfp_basic/tc_sequence.rb
|
52
42
|
- test/wfp_state_based/tc_deferredchoice.rb
|
43
|
+
- test/wfp_state_based/tc_interleavedparallelrouting.rb
|
53
44
|
- test/wfp_iteration/tc_structuredloop.rb
|
54
|
-
- test/
|
55
|
-
- test/
|
56
|
-
- test/
|
57
|
-
- test/
|
58
|
-
- test/wfp_adv_branching/tc_generalizedjoin.rb
|
59
|
-
- test/wfp_adv_branching/tc_threadsplit.rb
|
60
|
-
- test/wfp_adv_branching/tc_multimerge.rb
|
61
|
-
- test/wfp_adv_branching/tc_structured_discriminator.rb
|
62
|
-
- test/wfp_adv_branching/tc_structured_partial_join.rb
|
45
|
+
- test/basic/tc_choose.rb
|
46
|
+
- test/basic/tc_wf_control.rb
|
47
|
+
- test/basic/tc_endpoint.rb
|
48
|
+
- test/basic/tc_parallel.rb
|
63
49
|
- test/basic/tc_codereplace.rb
|
64
50
|
- test/basic/tc_data.rb
|
65
|
-
- test/basic/tc_handler.rb
|
66
|
-
- test/basic/tc_parallel.rb
|
67
51
|
- test/basic/tc_search.rb
|
68
|
-
- test/basic/tc_endpoint.rb
|
69
|
-
- test/basic/tc_wf_control.rb
|
70
|
-
- test/basic/tc_choose.rb
|
71
52
|
- test/basic/tc_state.rb
|
72
|
-
- test/
|
53
|
+
- test/basic/tc_handler.rb
|
54
|
+
- test/wfp_adv_branching/tc_multichoice_structuredsynchronizingmerge.rb
|
55
|
+
- test/wfp_adv_branching/tc_threadsplit.rb
|
56
|
+
- test/wfp_adv_branching/tc_multimerge.rb
|
57
|
+
- test/wfp_adv_branching/tc_threadmerge.rb
|
58
|
+
- test/wfp_adv_branching/tc_structured_partial_join.rb
|
59
|
+
- test/wfp_adv_branching/tc_generalizedjoin.rb
|
60
|
+
- test/wfp_adv_branching/tc_generalsynchronizingmerge.rb
|
61
|
+
- test/wfp_adv_branching/tc_structured_discriminator.rb
|
62
|
+
- test/wfp_adv_branching/tc_localsynchronizingmerge.rb
|
73
63
|
- test/complex/tc_generalsynchonizingmerge_loopsearch.rb
|
74
|
-
- test/
|
75
|
-
- test/wfp_basic/tc_sequence.rb
|
76
|
-
- test/wfp_basic/tc_parallelsplit_synchronization.rb
|
64
|
+
- test/complex/tc_parallel_stop.rb
|
77
65
|
homepage: http://cpee.org
|
78
|
-
licenses:
|
66
|
+
licenses:
|
67
|
+
- LGPL-2
|
79
68
|
post_install_message:
|
80
69
|
rdoc_options: []
|
81
70
|
require_paths:
|
@@ -85,7 +74,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
85
74
|
requirements:
|
86
75
|
- - ! '>='
|
87
76
|
- !ruby/object:Gem::Version
|
88
|
-
version:
|
77
|
+
version: 1.9.3
|
89
78
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
90
79
|
none: false
|
91
80
|
requirements:
|
@@ -94,39 +83,39 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
94
83
|
version: '0'
|
95
84
|
requirements: []
|
96
85
|
rubyforge_project:
|
97
|
-
rubygems_version: 1.8.
|
86
|
+
rubygems_version: 1.8.23
|
98
87
|
signing_key:
|
99
88
|
specification_version: 3
|
100
|
-
summary:
|
89
|
+
summary: Preliminary release of the Workflow Execution Engine Library (WEEL)
|
101
90
|
test_files:
|
102
91
|
- test/SimHandlerWrapper.rb
|
103
92
|
- test/TestHandlerWrapper.rb
|
104
93
|
- test/ContinueTest.rb
|
105
|
-
- test/TestMixin.rb
|
106
94
|
- test/TestWorkflow.rb
|
107
|
-
- test/
|
95
|
+
- test/TestMixin.rb
|
96
|
+
- test/wfp_basic/tc_exclusivechoice_simplemerge.rb
|
97
|
+
- test/wfp_basic/tc_parallelsplit_synchronization.rb
|
98
|
+
- test/wfp_basic/tc_sequence.rb
|
108
99
|
- test/wfp_state_based/tc_deferredchoice.rb
|
100
|
+
- test/wfp_state_based/tc_interleavedparallelrouting.rb
|
109
101
|
- test/wfp_iteration/tc_structuredloop.rb
|
110
|
-
- test/
|
111
|
-
- test/
|
112
|
-
- test/
|
113
|
-
- test/
|
114
|
-
- test/wfp_adv_branching/tc_generalizedjoin.rb
|
115
|
-
- test/wfp_adv_branching/tc_threadsplit.rb
|
116
|
-
- test/wfp_adv_branching/tc_multimerge.rb
|
117
|
-
- test/wfp_adv_branching/tc_structured_discriminator.rb
|
118
|
-
- test/wfp_adv_branching/tc_structured_partial_join.rb
|
102
|
+
- test/basic/tc_choose.rb
|
103
|
+
- test/basic/tc_wf_control.rb
|
104
|
+
- test/basic/tc_endpoint.rb
|
105
|
+
- test/basic/tc_parallel.rb
|
119
106
|
- test/basic/tc_codereplace.rb
|
120
107
|
- test/basic/tc_data.rb
|
121
|
-
- test/basic/tc_handler.rb
|
122
|
-
- test/basic/tc_parallel.rb
|
123
108
|
- test/basic/tc_search.rb
|
124
|
-
- test/basic/tc_endpoint.rb
|
125
|
-
- test/basic/tc_wf_control.rb
|
126
|
-
- test/basic/tc_choose.rb
|
127
109
|
- test/basic/tc_state.rb
|
128
|
-
- test/
|
110
|
+
- test/basic/tc_handler.rb
|
111
|
+
- test/wfp_adv_branching/tc_multichoice_structuredsynchronizingmerge.rb
|
112
|
+
- test/wfp_adv_branching/tc_threadsplit.rb
|
113
|
+
- test/wfp_adv_branching/tc_multimerge.rb
|
114
|
+
- test/wfp_adv_branching/tc_threadmerge.rb
|
115
|
+
- test/wfp_adv_branching/tc_structured_partial_join.rb
|
116
|
+
- test/wfp_adv_branching/tc_generalizedjoin.rb
|
117
|
+
- test/wfp_adv_branching/tc_generalsynchronizingmerge.rb
|
118
|
+
- test/wfp_adv_branching/tc_structured_discriminator.rb
|
119
|
+
- test/wfp_adv_branching/tc_localsynchronizingmerge.rb
|
129
120
|
- test/complex/tc_generalsynchonizingmerge_loopsearch.rb
|
130
|
-
- test/
|
131
|
-
- test/wfp_basic/tc_sequence.rb
|
132
|
-
- test/wfp_basic/tc_parallelsplit_synchronization.rb
|
121
|
+
- test/complex/tc_parallel_stop.rb
|