weel 1.99.37 → 1.99.38

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 32e1005b0f41f52946b44912e80015f710b8c7c1
4
- data.tar.gz: 55aba746487938da392df037239b3e9c67078c63
3
+ metadata.gz: 22064a6ed4dc9a0b9ff995c27e2b183a9ef8551e
4
+ data.tar.gz: 061c59695868707b3f3bc750ae83954518ef3e0c
5
5
  SHA512:
6
- metadata.gz: 8c2318a70fe3c7de7bc8c5c182877ce3ff53648c0c3bffc2d46104d3815f983c3eee5b06c8303ce4328209cb6a48f0d92734863cf593811f147005cc9884fa1e
7
- data.tar.gz: 121d51d53524c67784417ab80ee5bf8154cceff2588bde7eccd8f9c3ff54ce00037c07af2fe866630c0582f393392134034ef444a337fced3269ef9dc37479ed
6
+ metadata.gz: c575d29ce1ffae4f16da3fb46a89d4809b1e1c6053090c2b632766b14ba0f57cf7ec9e96e6ee3f764b0a1cc9344d48b77314d9aff2bb7cff03b43276a2efd93c
7
+ data.tar.gz: 9d207543b4186664e823baecd98a6338cf45d75906b43e785d175974078bc1c10fc851b19445b555a957bce4ec137a7623af77aab3d671c35ee6cb075614552a
data/lib/weel.rb CHANGED
@@ -1,15 +1,15 @@
1
1
  # encoding: utf-8
2
2
  #
3
3
  # This file is part of WEEL.
4
- #
4
+ #
5
5
  # WEEL is free software: you can redistribute it and/or modify it under the terms
6
6
  # of the GNU General Public License as published by the Free Software Foundation,
7
7
  # either version 3 of the License, or (at your option) any later version.
8
- #
8
+ #
9
9
  # WEEL is distributed in the hope that it will be useful, but WITHOUT ANY
10
10
  # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
11
11
  # PARTICULAR PURPOSE. See the GNU General Public License for more details.
12
- #
12
+ #
13
13
  # You should have received a copy of the GNU General Public License along with
14
14
  # WEEL (file COPYING in the main directory). If not, see
15
15
  # <http://www.gnu.org/licenses/>.
@@ -19,7 +19,7 @@ require 'thread'
19
19
  # OMG!111! strings have to be emptied
20
20
  class String # {{{
21
21
  def clear
22
- self.slice!(0..-1)
22
+ self.slice!(0..-1)
23
23
  end
24
24
  end # }}}
25
25
 
@@ -50,7 +50,7 @@ class WEEL
50
50
  def initialize(*args)# {{{
51
51
  @dslr = DSLRealization.new
52
52
  @dslr.__weel_handlerwrapper_args = args
53
-
53
+
54
54
  initialize_search if methods.include?(:initialize_search)
55
55
  initialize_data if methods.include?(:initialize_data)
56
56
  initialize_endpoints if methods.include?(:initialize_endpoints)
@@ -127,7 +127,7 @@ class WEEL
127
127
  if @__weel_values.has_key?(value)
128
128
  @__weel_what << value
129
129
  @__weel_values.delete(value)
130
- end
130
+ end
131
131
  end
132
132
 
133
133
  def clear
@@ -137,13 +137,13 @@ class WEEL
137
137
 
138
138
  def method_missing(name,*args)
139
139
  if args.empty? && @__weel_values.has_key?(name)
140
- @__weel_values[name]
140
+ @__weel_values[name]
141
141
  elsif name.to_s[-1..-1] == "=" && args.length == 1
142
142
  temp = name.to_s[0..-2]
143
143
  @__weel_what << temp.to_sym
144
144
  @__weel_values[temp.to_sym] = args[0]
145
- elsif name.to_s == "[]=" && args.length == 2
146
- @__weel_values[args[0]] = args[1]
145
+ elsif name.to_s == "[]=" && args.length == 2
146
+ @__weel_values[args[0]] = args[1]
147
147
  elsif name.to_s == "[]" && args.length == 1
148
148
  @__weel_values[args[0]]
149
149
  else
@@ -163,7 +163,7 @@ class WEEL
163
163
  end
164
164
  attr_reader :id, :message
165
165
  end #}}}
166
-
166
+
167
167
  class ReadHash # {{{
168
168
  def initialize(values,sim=false)
169
169
  @__weel_values = values
@@ -179,8 +179,8 @@ class WEEL
179
179
  if @__weel_sim
180
180
  "➤#{name}"
181
181
  else
182
- @__weel_values[name]
183
- end
182
+ @__weel_values[name]
183
+ end
184
184
  #TODO dont let user change stuff e.g. if return value is an array (deep clone and/or deep freeze it?)
185
185
  else
186
186
  nil
@@ -209,7 +209,7 @@ class WEEL
209
209
  def inform_manipulate_change(status,changed_data,changed_endpoints,data,endpoints); end
210
210
  def inform_position_change(ipc); end
211
211
  def inform_state_change(newstate); end
212
-
212
+
213
213
  def vote_sync_before(parameters=nil); true; end
214
214
  def vote_sync_after; true; end
215
215
 
@@ -219,7 +219,7 @@ class WEEL
219
219
  # parameters => stuff given to the control structure
220
220
  def simulate(type,nesting,sequence,parent,parameters={}); end
221
221
 
222
- def callback(result); end
222
+ def callback(result=nil,options={}); end
223
223
 
224
224
  def test_condition(mr,code); mr.instance_eval(code); end
225
225
  def manipulate(mr,code,result=nil,status=nil); mr.instance_eval(code); end
@@ -239,12 +239,12 @@ class WEEL
239
239
  def initialize
240
240
  @q = Queue.new
241
241
  @m = Mutex.new
242
- end
242
+ end
243
243
  def waiting?
244
244
  @m.synchronize do
245
245
  !@q.empty?
246
- end
247
- end
246
+ end
247
+ end
248
248
  def continue(*args)
249
249
  @q.push(args.length <= 1 ? args[0] : args)
250
250
  end
@@ -257,7 +257,7 @@ class WEEL
257
257
  end #}}}
258
258
 
259
259
  def self::search(weel_search)# {{{
260
- define_method :initialize_search do
260
+ define_method :initialize_search do
261
261
  self.search weel_search
262
262
  end
263
263
  end # }}}
@@ -280,11 +280,11 @@ class WEEL
280
280
  end
281
281
  end # }}}
282
282
  def self::handlerwrapper(aClassname, *args)# {{{
283
- define_method :initialize_handlerwrapper do
283
+ define_method :initialize_handlerwrapper do
284
284
  self.handlerwrapper = aClassname
285
285
  self.handlerwrapper_args = args unless args.empty?
286
286
  end
287
- end # }}}
287
+ end # }}}
288
288
  def self::control(flow, &block)# {{{
289
289
  @@__weel_control_block = block
290
290
  define_method :initialize_control do
@@ -315,13 +315,13 @@ class WEEL
315
315
  # position: a unique identifier within the wf-description (may be used by the search to identify a starting point)
316
316
  # endpoint: (only with :call) ep of the service
317
317
  # parameters: (only with :call) service parameters
318
- def call(position, endpoint, parameters={}, code=nil, &blk)
319
- __weel_activity(position,:call,endpoint,parameters,code||blk)
320
- end
321
- def manipulate(position, code=nil, &blk)
322
- __weel_activity(position,:manipulate,nil,{},code||blk)
323
- end
324
-
318
+ def call(position, endpoint, parameters={}, finalize=nil, update=nil, &finalizeblk)
319
+ __weel_activity(position,:call,endpoint,parameters,finalize||finalizeblk,update)
320
+ end
321
+ def manipulate(position, code=nil, &codeblk)
322
+ __weel_activity(position,:manipulate,nil,{},code||codeblk)
323
+ end
324
+
325
325
  # Parallel DSL-Construct
326
326
  # Defines Workflow paths that can be executed parallel.
327
327
  # May contain multiple branches (parallel_branch)
@@ -340,14 +340,14 @@ class WEEL
340
340
  Thread.current[:branch_wait_count] = (type.is_a?(Hash) && type.size == 1 && type[:wait] != nil && (type[:wait].is_a?(Integer) && type[:wait] > 0) ? type[:wait] : Thread.current[:branches].size)
341
341
  1.upto Thread.current[:branches].size do
342
342
  Thread.current[:branch_event].wait
343
- end
343
+ end
344
344
 
345
- Thread.current[:branches].each do |thread|
345
+ Thread.current[:branches].each do |thread|
346
346
  # decide after executing block in parallel cause for coopis
347
347
  # it goes out of search mode while dynamically counting branches
348
348
  if Thread.current[:branch_search] == false
349
349
  thread[:branch_search] = false
350
- end
350
+ end
351
351
  thread[:start_event].continue
352
352
  end
353
353
 
@@ -357,14 +357,14 @@ class WEEL
357
357
 
358
358
  unless self.__weel_state == :stopping || self.__weel_state == :stopped
359
359
  # first set all to no_longer_neccessary
360
- Thread.current[:branches].each do |thread|
361
- if thread.alive?
360
+ Thread.current[:branches].each do |thread|
361
+ if thread.alive?
362
362
  thread[:nolongernecessary] = true
363
363
  __weel_recursive_continue(thread)
364
- end
364
+ end
365
365
  end
366
366
  # wait for all
367
- Thread.current[:branches].each do |thread|
367
+ Thread.current[:branches].each do |thread|
368
368
  __weel_recursive_join(thread)
369
369
  end
370
370
  end
@@ -378,7 +378,7 @@ class WEEL
378
378
  if __weel_sim
379
379
  # catch the potential execution in loops inside a parallel
380
380
  current_branch_sim_pos = branch_parent[:branch_sim_pos]
381
- end
381
+ end
382
382
 
383
383
  Thread.current[:branches] << Thread.new(*vars) do |*local|
384
384
  Thread.current.abort_on_exception = true
@@ -388,7 +388,7 @@ class WEEL
388
388
 
389
389
  if __weel_sim
390
390
  Thread.current[:branch_sim_pos] = @__weel_sim += 1
391
- end
391
+ end
392
392
 
393
393
  # parallel_branch could be possibly around an alternative. Thus thread has to inherit the alternative_executed
394
394
  # after branching, update it in the parent (TODO)
@@ -420,8 +420,8 @@ class WEEL
420
420
  branch_parent[:branch_finished_count] += 1
421
421
  if branch_parent[:branch_finished_count] == branch_parent[:branch_wait_count] && self.__weel_state != :stopping
422
422
  branch_parent[:branch_event].continue
423
- end
424
- end
423
+ end
424
+ end
425
425
  if self.__weel_state != :stopping && self.__weel_state != :stopped
426
426
  if Thread.current[:branch_position]
427
427
  @__weel_positions.delete Thread.current[:branch_position]
@@ -432,8 +432,8 @@ class WEEL
432
432
  handlerwrapper.inform_position_change(ipc)
433
433
  end rescue nil
434
434
  Thread.current[:branch_position] = nil
435
- end
436
- end
435
+ end
436
+ end
437
437
  end
438
438
  Thread.pass
439
439
  end # }}}
@@ -469,7 +469,7 @@ class WEEL
469
469
  condition = handlerwrapper.test_condition(ReadStructure.new(@__weel_data,@__weel_endpoints),condition)
470
470
  end
471
471
  Thread.current[:alternative_executed][-1] = true if condition
472
- end
472
+ end
473
473
  yield if __weel_is_in_search_mode || __weel_sim || condition
474
474
  __weel_sim_stop(:alternative,hw,pos,args.merge(:mode => Thread.current[:alternative_mode].last, :condition => condition.is_a?(String) ? condition : nil)) if __weel_sim
475
475
  end # }}}
@@ -495,7 +495,7 @@ class WEEL
495
495
  end # }}}
496
496
 
497
497
  # Defines a Cycle (loop/iteration)
498
- def loop(condition,args={})# {{{
498
+ def loop(condition,args={})# {{{
499
499
  unless condition.is_a?(Array) && (condition[0].is_a?(Proc) || condition[0].is_a?(String)) && [:pre_test,:post_test].include?(condition[1]) && args.is_a?(Hash)
500
500
  raise "condition must be called pre_test{} or post_test{}"
501
501
  end
@@ -505,7 +505,7 @@ class WEEL
505
505
  yield
506
506
  end
507
507
  return if __weel_is_in_search_mode
508
- end
508
+ end
509
509
  if __weel_sim
510
510
  cond = condition[0].is_a?(Proc) ? true : condition[0]
511
511
  hw, pos = __weel_sim_start(:loop,args.merge(:testing=>condition[1],:condition=>cond))
@@ -521,7 +521,7 @@ class WEEL
521
521
  when :pre_test
522
522
  while (condition[0].is_a?(Proc) ? condition[0].call : handlerwrapper.test_condition(ReadStructure.new(@__weel_data,@__weel_endpoints),condition[0])) && self.__weel_state != :stopping && self.__weel_state != :stopped
523
523
  yield
524
- end
524
+ end
525
525
  when :post_test
526
526
  begin
527
527
  yield
@@ -550,7 +550,7 @@ class WEEL
550
550
  end # }}}
551
551
 
552
552
  private
553
- def __weel_activity(position, type, endpoints, parameters, code)# {{{
553
+ def __weel_activity(position, type, endpoints, parameters, finalize, update=nil)# {{{
554
554
  position = __weel_position_test position
555
555
  begin
556
556
  searchmode = __weel_is_in_search_mode(position)
@@ -561,7 +561,7 @@ class WEEL
561
561
  handlerwrapper = @__weel_handlerwrapper.new @__weel_handlerwrapper_args, endpoints.is_a?(Array) ? endpoints.map{|ep| @__weel_endpoints[ep] }.compact : @__weel_endpoints[endpoints], position, Thread.current[:continue]
562
562
 
563
563
  if __weel_sim
564
- handlerwrapper.simulate(:activity,:none,@__weel_sim += 1,Thread.current[:branch_sim_pos],:position => position,:parameters => parameters,:endpoints => endpoints,:type => type,:code => code.is_a?(String) ? code : nil)
564
+ handlerwrapper.simulate(:activity,:none,@__weel_sim += 1,Thread.current[:branch_sim_pos],:position => position,:parameters => parameters,:endpoints => endpoints,:type => type,:finalize => finalize.is_a?(String) ? finalize : nil)
565
565
  return
566
566
  end
567
567
 
@@ -569,18 +569,18 @@ class WEEL
569
569
  if searchmode == :after
570
570
  wp = WEEL::Position.new(position, :after, nil)
571
571
  ipc[:after] = [wp.position]
572
- else
572
+ else
573
573
  if Thread.current[:branch_parent] && Thread.current[:branch_parent][:branch_position]
574
574
  @__weel_positions.delete Thread.current[:branch_parent][:branch_position]
575
575
  ipc[:unmark] ||= []
576
576
  ipc[:unmark] << Thread.current[:branch_parent][:branch_position].position rescue nil
577
577
  Thread.current[:branch_parent][:branch_position] = nil
578
- end
578
+ end
579
579
  if Thread.current[:branch_position]
580
580
  @__weel_positions.delete Thread.current[:branch_position]
581
581
  ipc[:unmark] ||= []
582
582
  ipc[:unmark] << Thread.current[:branch_position].position rescue nil
583
- end
583
+ end
584
584
  wp = WEEL::Position.new(position, :at, nil)
585
585
  ipc[:at] = [wp.position]
586
586
  end
@@ -596,17 +596,17 @@ class WEEL
596
596
  when :manipulate
597
597
  raise Signal::Stop unless handlerwrapper.vote_sync_before
598
598
 
599
- if code.is_a?(Proc) || code.is_a?(String)
599
+ if finalize.is_a?(Proc) || finalize.is_a?(String)
600
600
  handlerwrapper.inform_activity_manipulate
601
- if code.is_a?(Proc)
601
+ if finalize.is_a?(Proc)
602
602
  mr = ManipulateStructure.new(@__weel_data,@__weel_endpoints,@__weel_status)
603
- mr.instance_eval(&code)
604
- elsif code.is_a?(String)
603
+ mr.instance_eval(&finalize)
604
+ elsif finalize.is_a?(String)
605
605
  mr = ManipulateStructure.new(@__weel_data,@__weel_endpoints,@__weel_status)
606
- handlerwrapper.manipulate(mr,code)
607
- end
606
+ handlerwrapper.manipulate(mr,finalize)
607
+ end
608
608
  handlerwrapper.inform_manipulate_change(
609
- ((mr && mr.changed_status) ? @__weel_status : nil),
609
+ ((mr && mr.changed_status) ? @__weel_status : nil),
610
610
  ((mr && mr.changed_data.any?) ? mr.changed_data.uniq : nil),
611
611
  ((mr && mr.changed_endpoints.any?) ? mr.changed_endpoints.uniq : nil),
612
612
  @__weel_data,
@@ -615,58 +615,52 @@ class WEEL
615
615
  handlerwrapper.inform_activity_done
616
616
  wp.detail = :after
617
617
  handlerwrapper.inform_position_change :after => [wp.position]
618
- end
618
+ end
619
619
  when :call
620
620
  params = { }
621
- case parameters
622
- when String
623
- code = parameters
624
- parameters = nil
621
+ case parameters
625
622
  when Hash
626
623
  parameters.each do |k,p|
627
624
  if p.is_a?(Symbol) && @__weel_data.include?(p)
628
625
  params[k] = @__weel_data[p]
629
- elsif k == :code && p.is_a?(String)
630
- code = p
631
626
  else
632
627
  params[k] = p
633
628
  end
634
- end
635
- when Array
629
+ end
630
+ when Array
636
631
  parameters.each_with_index do |p,i|
637
632
  if p.is_a?(Symbol) && @__weel_data.include?(p)
638
633
  params[p] = @__weel_data[p]
639
634
  else
640
635
  params[i] = p
641
- end
636
+ end
642
637
  end
643
- else
638
+ else
644
639
  raise("invalid parameters")
645
640
  end
646
641
  raise Signal::Stop unless handlerwrapper.vote_sync_before(params)
647
642
 
648
643
  passthrough = @__weel_search_positions[position] ? @__weel_search_positions[position].passthrough : nil
644
+ handlerwrapper.activity_handle passthrough, params
649
645
  begin
650
646
  # with loop if catching Signal::Again
651
647
  # handshake call and wait until it finished
652
-
653
- handlerwrapper.activity_handle passthrough, params
654
648
  waitingresult = nil
655
649
  waitingresult = Thread.current[:continue].wait unless Thread.current[:nolongernecessary] || self.__weel_state == :stopping || self.__weel_state == :stopped
656
- raise waitingresult if !waitingresult.nil? && waitingresult.is_a?(Signal::Again)
657
650
  raise waitingresult[1] if !waitingresult.nil? && waitingresult.is_a?(Array) && waitingresult.length == 2 && waitingresult[0] == WEEL::Signal::Error
658
651
 
659
652
  if Thread.current[:nolongernecessary]
660
- handlerwrapper.activity_no_longer_necessary
653
+ handlerwrapper.activity_no_longer_necessary
661
654
  raise Signal::NoLongerNecessary
662
- end
655
+ end
663
656
  if self.__weel_state == :stopping
664
657
  handlerwrapper.activity_stop
665
658
  wp.passthrough = handlerwrapper.activity_passthrough_value
666
659
  raise Signal::Proceed
667
- end
660
+ end
668
661
 
669
- if wp.passthrough.nil? && (code.is_a?(Proc) || code.is_a?(String))
662
+ code = waitingresult == Signal::Again ? update : finalize
663
+ if code.is_a?(Proc) || code.is_a?(String)
670
664
  handlerwrapper.inform_activity_manipulate
671
665
  status = handlerwrapper.activity_result_status
672
666
  if code.is_a?(Proc)
@@ -676,25 +670,25 @@ class WEEL
676
670
  when 2; mr.instance_exec(handlerwrapper.activity_result_value,(status.is_a?(Status)?status:nil),&code)
677
671
  else
678
672
  mr.instance_eval(&code)
679
- end
680
- elsif code.is_a?(String)
673
+ end
674
+ elsif code.is_a?(String)
681
675
  mr = ManipulateStructure.new(@__weel_data,@__weel_endpoints,@__weel_status)
682
676
  handlerwrapper.manipulate(mr,code,handlerwrapper.activity_result_value,(status.is_a?(Status)?status:nil))
683
677
  end
684
678
  handlerwrapper.inform_manipulate_change(
685
- (mr.changed_status ? @__weel_status : nil),
679
+ (mr.changed_status ? @__weel_status : nil),
686
680
  (mr.changed_data.any? ? mr.changed_data.uniq : nil),
687
681
  (mr.changed_endpoints.any? ? mr.changed_endpoints.uniq : nil),
688
682
  @__weel_data,
689
683
  @__weel_endpoints
690
684
  )
691
685
  end
692
- end while wp.passthrough.nil? && waitingresult == Signal::Again
686
+ end while waitingresult == Signal::Again
693
687
  if wp.passthrough.nil?
694
688
  handlerwrapper.inform_activity_done
695
689
  wp.detail = :after
696
690
  handlerwrapper.inform_position_change :after => [wp.position]
697
- end
691
+ end
698
692
  end
699
693
  raise Signal::Proceed
700
694
  rescue Signal::SkipManipulate, Signal::Proceed
@@ -723,7 +717,7 @@ class WEEL
723
717
  thread[:branches].each do |b|
724
718
  __weel_recursive_print(b,indent+' ')
725
719
  end
726
- end
720
+ end
727
721
  end # }}}
728
722
  def __weel_recursive_continue(thread)# {{{
729
723
  return unless thread
@@ -733,13 +727,13 @@ class WEEL
733
727
  if thread.alive? && thread[:branch_event]
734
728
  thread[:mutex].synchronize do
735
729
  thread[:branch_event].continue unless thread[:branch_event].nil?
736
- end
737
- end
730
+ end
731
+ end
738
732
  if thread[:branches]
739
733
  thread[:branches].each do |b|
740
734
  __weel_recursive_continue(b)
741
735
  end
742
- end
736
+ end
743
737
  end # }}}
744
738
  def __weel_recursive_join(thread)# {{{
745
739
  return unless thread
@@ -750,13 +744,13 @@ class WEEL
750
744
  thread[:branches].each do |b|
751
745
  __weel_recursive_join(b)
752
746
  end
753
- end
747
+ end
754
748
  end # }}}
755
749
 
756
750
  def __weel_position_test(position)# {{{
757
751
  if position.is_a?(Symbol) && position.to_s =~ /[a-zA-Z][a-zA-Z0-9_]*/
758
752
  position
759
- else
753
+ else
760
754
  self.__weel_state = :stopping
761
755
  handlerwrapper = @__weel_handlerwrapper.new @__weel_handlerwrapper_args
762
756
  handlerwrapper.inform_syntax_error(Exception.new("position (#{position}) not valid"),nil)
@@ -774,9 +768,9 @@ class WEEL
774
768
  branch[:branch_search] = false
775
769
  end
776
770
  @__weel_search_positions[position].detail == :after ? :after : false
777
- else
771
+ else
778
772
  branch[:branch_search] = true
779
- end
773
+ end
780
774
  end # }}}
781
775
 
782
776
  def __weel_sim
@@ -789,13 +783,13 @@ class WEEL
789
783
  handlerwrapper = @__weel_handlerwrapper.new @__weel_handlerwrapper_args
790
784
  handlerwrapper.simulate(what,:start,Thread.current[:branch_sim_pos],current_branch_sim_pos,options)
791
785
  [handlerwrapper, current_branch_sim_pos]
792
- end
786
+ end
793
787
 
794
788
  def __weel_sim_stop(what,handlerwrapper,current_branch_sim_pos,options={})
795
789
  handlerwrapper.simulate(what,:end,Thread.current[:branch_sim_pos],current_branch_sim_pos,options)
796
790
  Thread.current[:branch_sim_pos] = current_branch_sim_pos
797
791
  end
798
-
792
+
799
793
  public
800
794
  def __weel_finalize
801
795
  __weel_recursive_join(@__weel_main)
@@ -814,11 +808,11 @@ class WEEL
814
808
  if newState == :stopping
815
809
  __weel_recursive_continue(@__weel_main)
816
810
  end
817
-
811
+
818
812
  handlerwrapper.inform_state_change @__weel_state
819
813
  end # }}}
820
814
 
821
- end # }}}
815
+ end # }}}
822
816
 
823
817
  public
824
818
  def positions # {{{
@@ -842,7 +836,7 @@ public
842
836
  # Get/Set the handlerwrapper arguments
843
837
  def handlerwrapper_args # {{{
844
838
  @dslr.__weel_handlerwrapper_args
845
- end # }}}
839
+ end # }}}
846
840
  def handlerwrapper_args=(args) # {{{
847
841
  if args.class == Array
848
842
  @dslr.__weel_handlerwrapper_args = args
@@ -868,14 +862,14 @@ public
868
862
 
869
863
  if !new_weel_search.is_a?(Array) || new_weel_search.empty?
870
864
  false
871
- else
872
- new_weel_search.each do |search_position|
865
+ else
866
+ new_weel_search.each do |search_position|
873
867
  @dslr.__weel_search_positions[search_position.position] = search_position
874
- end
868
+ end
875
869
  true
876
870
  end
877
871
  end # }}}
878
-
872
+
879
873
  def data(new_data=nil) # {{{
880
874
  unless new_data.nil? || !new_data.is_a?(Hash)
881
875
  new_data.each{|k,v|@dslr.__weel_data[k] = v}
@@ -910,16 +904,16 @@ public
910
904
  begin
911
905
  if code.is_a? Proc
912
906
  @dslr.instance_eval(&code)
913
- else
907
+ else
914
908
  @dslr.instance_eval(code)
915
- end
909
+ end
916
910
  rescue Exception => err
917
911
  @dslr.__weel_state = :stopping
918
912
  handlerwrapper = @dslr.__weel_handlerwrapper.new @dslr.__weel_handlerwrapper_args
919
913
  handlerwrapper.inform_syntax_error(err,code)
920
914
  end
921
915
  if @dslr.__weel_state == :running
922
- @dslr.__weel_state = :finished
916
+ @dslr.__weel_state = :finished
923
917
  ipc = { :unmark => [] }
924
918
  @dslr.__weel_positions.each{|wp| ipc[:unmark] << wp.position}
925
919
  @dslr.__weel_positions.clear
@@ -928,7 +922,7 @@ public
928
922
  end
929
923
  if @dslr.__weel_state == :simulating
930
924
  @dslr.__weel_state = final_state
931
- end
925
+ end
932
926
  if @dslr.__weel_state == :stopping
933
927
  @dslr.__weel_finalize
934
928
  end
@@ -941,7 +935,7 @@ public
941
935
  Thread.new do
942
936
  @dslr.__weel_state = :stopping
943
937
  @dslr.__weel_main.join if @dslr.__weel_main
944
- end
938
+ end
945
939
  end # }}}
946
940
  # Start the workflow execution
947
941
  def start # {{{
data/test/exec/tc_exec.rb CHANGED
@@ -11,7 +11,7 @@ class TestChoose < Test::Unit::TestCase
11
11
  manipulate :a_1, <<-end
12
12
  data.a = 1
13
13
  end
14
- call :a_2, :endpoint1, <<-end
14
+ call :a_2, :endpoint1 do
15
15
  data.b = 1
16
16
  end
17
17
  end
@@ -0,0 +1,27 @@
1
+ require 'test/unit'
2
+ require File.expand_path(::File.dirname(__FILE__) + '/../TestWorkflow')
3
+
4
+ class TestSpeed1 < Test::Unit::TestCase
5
+ include TestMixin
6
+
7
+ def test_speed1
8
+ 1.upto(10000) do
9
+ wf = TestWorkflow.new
10
+ wf.description do
11
+ choose do
12
+ alternative true do
13
+ call :a_1, :endpoint1
14
+ end
15
+ alternative false do
16
+ call :a_2, :endpoint1
17
+ end
18
+ otherwise do
19
+ call :a_3, :endpoint1
20
+ end
21
+ end
22
+ end
23
+ wf.start.join
24
+ end
25
+ end
26
+
27
+ end
@@ -0,0 +1,17 @@
1
+ require 'test/unit'
2
+ require File.expand_path(::File.dirname(__FILE__) + '/../TestWorkflow')
3
+
4
+ class TestSpeed2 < Test::Unit::TestCase
5
+ include TestMixin
6
+
7
+ def test_speed2
8
+ wf = TestWorkflow.new
9
+ wf.description do
10
+ 1.upto(10000) do
11
+ call :a_1, :endpoint1
12
+ end
13
+ end
14
+ wf.start.join
15
+ end
16
+
17
+ end
data/weel.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "weel"
3
- s.version = "1.99.37"
3
+ s.version = "1.99.38"
4
4
  s.platform = Gem::Platform::RUBY
5
5
  s.license = "LGPL-3"
6
6
  s.summary = "Preliminary release of the Workflow Execution Engine Library (WEEL)"
@@ -17,4 +17,6 @@ Gem::Specification.new do |s|
17
17
  s.authors = ['Juergen eTM Mangler','Gerhard Stuermer']
18
18
  s.email = 'juergen.mangler@gmail.com'
19
19
  s.homepage = 'http://cpee.org/'
20
+
21
+ s.add_runtime_dependency 'test-unit', '~> 3.0'
20
22
  end
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.37
4
+ version: 1.99.38
5
5
  platform: ruby
6
6
  authors:
7
7
  - Juergen eTM Mangler
@@ -9,8 +9,22 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-10-12 00:00:00.000000000 Z
13
- dependencies: []
12
+ date: 2015-02-14 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: test-unit
16
+ requirement: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - "~>"
19
+ - !ruby/object:Gem::Version
20
+ version: '3.0'
21
+ type: :runtime
22
+ prerelease: false
23
+ version_requirements: !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - "~>"
26
+ - !ruby/object:Gem::Version
27
+ version: '3.0'
14
28
  description: see http://cpee.org
15
29
  email: juergen.mangler@gmail.com
16
30
  executables: []
@@ -49,6 +63,8 @@ files:
49
63
  - test/complexsearch/tc_search.rb
50
64
  - test/exec/tc_again.rb
51
65
  - test/exec/tc_exec.rb
66
+ - test/speed/tc_speed1.rb
67
+ - test/speed/tc_speed2.rb
52
68
  - test/wfp_adv_branching/tc_generalizedjoin.rb
53
69
  - test/wfp_adv_branching/tc_generalsynchronizingmerge.rb
54
70
  - test/wfp_adv_branching/tc_localsynchronizingmerge.rb
@@ -85,43 +101,45 @@ required_rubygems_version: !ruby/object:Gem::Requirement
85
101
  version: '0'
86
102
  requirements: []
87
103
  rubyforge_project:
88
- rubygems_version: 2.2.2
104
+ rubygems_version: 2.4.5
89
105
  signing_key:
90
106
  specification_version: 4
91
107
  summary: Preliminary release of the Workflow Execution Engine Library (WEEL)
92
108
  test_files:
93
- - test/TestHandlerWrapper.rb
94
109
  - test/SimHandlerWrapper.rb
95
- - test/ContinueTest.rb
96
110
  - test/TestMixin.rb
111
+ - test/TestHandlerWrapper.rb
112
+ - test/ContinueTest.rb
97
113
  - test/README
98
114
  - test/TestWorkflow.rb
99
- - test/complex/tc_parallel_stop.rb
100
- - test/complex/tc_generalsynchonizingmerge_loopsearch.rb
101
- - test/wfp_state_based/tc_interleavedparallelrouting.rb
102
- - test/wfp_state_based/tc_deferredchoice.rb
103
- - test/wfp_basic/tc_parallelsplit_synchronization.rb
104
- - test/wfp_basic/tc_sequence.rb
105
- - test/wfp_basic/tc_exclusivechoice_simplemerge.rb
106
- - test/basic/tc_data.rb
115
+ - test/wfp_adv_branching/tc_threadsplit.rb
116
+ - test/wfp_adv_branching/tc_structured_discriminator.rb
117
+ - test/wfp_adv_branching/tc_multichoice_structuredsynchronizingmerge.rb
118
+ - test/wfp_adv_branching/tc_multimerge.rb
119
+ - test/wfp_adv_branching/tc_generalsynchronizingmerge.rb
120
+ - test/wfp_adv_branching/tc_localsynchronizingmerge.rb
121
+ - test/wfp_adv_branching/tc_generalizedjoin.rb
122
+ - test/wfp_adv_branching/tc_threadmerge.rb
123
+ - test/wfp_adv_branching/tc_structured_partial_join.rb
124
+ - test/wfp_iteration/tc_structuredloop.rb
107
125
  - test/basic/tc_codereplace.rb
108
- - test/basic/tc_state.rb
109
- - test/basic/tc_wf_control.rb
110
- - test/basic/tc_choose.rb
111
- - test/basic/tc_search.rb
112
- - test/basic/tc_handler.rb
113
126
  - test/basic/tc_endpoint.rb
127
+ - test/basic/tc_handler.rb
114
128
  - test/basic/tc_parallel.rb
115
- - test/wfp_iteration/tc_structuredloop.rb
116
- - test/complexsearch/tc_search.rb
129
+ - test/basic/tc_search.rb
130
+ - test/basic/tc_state.rb
131
+ - test/basic/tc_choose.rb
132
+ - test/basic/tc_data.rb
133
+ - test/basic/tc_wf_control.rb
117
134
  - test/exec/tc_exec.rb
118
135
  - test/exec/tc_again.rb
119
- - test/wfp_adv_branching/tc_threadsplit.rb
120
- - test/wfp_adv_branching/tc_generalizedjoin.rb
121
- - test/wfp_adv_branching/tc_structured_partial_join.rb
122
- - test/wfp_adv_branching/tc_multichoice_structuredsynchronizingmerge.rb
123
- - test/wfp_adv_branching/tc_threadmerge.rb
124
- - test/wfp_adv_branching/tc_generalsynchronizingmerge.rb
125
- - test/wfp_adv_branching/tc_localsynchronizingmerge.rb
126
- - test/wfp_adv_branching/tc_structured_discriminator.rb
127
- - test/wfp_adv_branching/tc_multimerge.rb
136
+ - test/wfp_basic/tc_sequence.rb
137
+ - test/wfp_basic/tc_parallelsplit_synchronization.rb
138
+ - test/wfp_basic/tc_exclusivechoice_simplemerge.rb
139
+ - test/wfp_state_based/tc_interleavedparallelrouting.rb
140
+ - test/wfp_state_based/tc_deferredchoice.rb
141
+ - test/complex/tc_generalsynchonizingmerge_loopsearch.rb
142
+ - test/complex/tc_parallel_stop.rb
143
+ - test/complexsearch/tc_search.rb
144
+ - test/speed/tc_speed2.rb
145
+ - test/speed/tc_speed1.rb