Skip to content

Breaking out of nested cursor in subprocess block #42

@chrisconley

Description

@chrisconley

I'm having some trouble with breaking out to a main cursor from within a cursor in a subprocess block. I've set up two test cases to illustrate what's going on below. Am I trying to do something unsupported/wacky or would you expect both of these test cases to pass?

Thanks!
Chris

  def test_nested_break_passes
    pdef = Ruote.process_definition do
      define "sub1" do
        # do some stuff
        apply # apply isn't in a new cusor - process works fine
        #do some more stuff
      end

      cursor :tag => "main" do
        sub1 do
          bravo
        end
        sub1 do
          alpha
        end
      end

      charly
    end

    alpha = @dashboard.register_participant :alpha, Ruote::StorageParticipant
    bravo = @dashboard.register_participant :bravo, Ruote::StorageParticipant
    charly = @dashboard.register_participant :charly, Ruote::StorageParticipant


    wfid = @dashboard.launch(pdef)
    wait_for(:bravo)
    wi = bravo.first
    wi.fields['__command__'] = [ 'break', "main" ]

    @dashboard.reply(wi)
    wait_for(:charly)
  end

  def test_nested_break_hangs
    pdef = Ruote.process_definition do
      define "sub1" do
        cursor do
          # do some stuff
          apply # apply is now nested in a cursor
          # do some more stuff
        end
      end

      cursor :tag => "main" do
        sub1 do
          bravo
        end
        sub1 do
          alpha
        end
      end

      charly
    end

    alpha = @dashboard.register_participant :alpha, Ruote::StorageParticipant
    bravo = @dashboard.register_participant :bravo, Ruote::StorageParticipant
    charly = @dashboard.register_participant :charly, Ruote::StorageParticipant


    wfid = @dashboard.launch(pdef)
    wait_for(:bravo)
    wi = bravo.first
    wi.fields['__command__'] = [ 'break', "main" ]

    @dashboard.reply(wi)
    wait_for(:charly)
  end

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions