Class: Roby::ExecutionEngine::PropagationInfo Private

Inherits:
Struct
  • Object
show all
Defined in:
lib/roby/execution_engine.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Gathering of all the errors that happened during an event processing loop and were not handled

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(called_generators = Set.new, emitted_events = Set.new, kill_tasks = Set.new, fatal_errors = [], nonfatal_errors = [], free_events_errors = [], handled_errors = [], inhibited_errors = [], framework_errors = []) ⇒ PropagationInfo

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of PropagationInfo.



1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
# File 'lib/roby/execution_engine.rb', line 1562

def initialize(called_generators = Set.new,
               emitted_events = Set.new,
               kill_tasks = Set.new,
               fatal_errors = [],
               nonfatal_errors = [],
               free_events_errors = [],
               handled_errors = [],
               inhibited_errors = [],
               framework_errors = [])

    self.called_generators  = called_generators.to_set
    self.emitted_events     = emitted_events.to_set
    self.kill_tasks         = kill_tasks.to_set
    self.fatal_errors       = fatal_errors
    self.nonfatal_errors    = nonfatal_errors
    self.free_events_errors = free_events_errors
    self.handled_errors     = handled_errors
    self.inhibited_errors   = inhibited_errors
    self.framework_errors = framework_errors
end

Instance Attribute Details

#called_generatorsObject

Returns the value of attribute called_generators

Returns:

  • (Object)

    the current value of called_generators



1557
1558
1559
# File 'lib/roby/execution_engine.rb', line 1557

def called_generators
  @called_generators
end

#emitted_eventsObject

Returns the value of attribute emitted_events

Returns:

  • (Object)

    the current value of emitted_events



1557
1558
1559
# File 'lib/roby/execution_engine.rb', line 1557

def emitted_events
  @emitted_events
end

#fatal_errorsObject

Returns the value of attribute fatal_errors

Returns:

  • (Object)

    the current value of fatal_errors



1557
1558
1559
# File 'lib/roby/execution_engine.rb', line 1557

def fatal_errors
  @fatal_errors
end

#framework_errorsObject

Returns the value of attribute framework_errors

Returns:

  • (Object)

    the current value of framework_errors



1557
1558
1559
# File 'lib/roby/execution_engine.rb', line 1557

def framework_errors
  @framework_errors
end

#free_events_errorsObject

Returns the value of attribute free_events_errors

Returns:

  • (Object)

    the current value of free_events_errors



1557
1558
1559
# File 'lib/roby/execution_engine.rb', line 1557

def free_events_errors
  @free_events_errors
end

#handled_errorsObject

Returns the value of attribute handled_errors

Returns:

  • (Object)

    the current value of handled_errors



1557
1558
1559
# File 'lib/roby/execution_engine.rb', line 1557

def handled_errors
  @handled_errors
end

#inhibited_errorsObject

Returns the value of attribute inhibited_errors

Returns:

  • (Object)

    the current value of inhibited_errors



1557
1558
1559
# File 'lib/roby/execution_engine.rb', line 1557

def inhibited_errors
  @inhibited_errors
end

#kill_tasksObject

Returns the value of attribute kill_tasks

Returns:

  • (Object)

    the current value of kill_tasks



1557
1558
1559
# File 'lib/roby/execution_engine.rb', line 1557

def kill_tasks
  @kill_tasks
end

#nonfatal_errorsObject

Returns the value of attribute nonfatal_errors

Returns:

  • (Object)

    the current value of nonfatal_errors



1557
1558
1559
# File 'lib/roby/execution_engine.rb', line 1557

def nonfatal_errors
  @nonfatal_errors
end

Instance Method Details

#add_event_emission(event) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



1599
1600
1601
# File 'lib/roby/execution_engine.rb', line 1599

def add_event_emission(event)
    emitted_events << event
end

#add_framework_errors(errors) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



1672
1673
1674
# File 'lib/roby/execution_engine.rb', line 1672

def add_framework_errors(errors)
    framework_errors.concat(errors)
end

#add_generator_call(generator) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



1595
1596
1597
# File 'lib/roby/execution_engine.rb', line 1595

def add_generator_call(generator)
    called_generators << generator
end

#each_called_generator(&block) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



1603
1604
1605
# File 'lib/roby/execution_engine.rb', line 1603

def each_called_generator(&block)
    called_generators.each(&block)
end

#each_emitted_event(&block) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



1611
1612
1613
# File 'lib/roby/execution_engine.rb', line 1611

def each_emitted_event(&block)
    emitted_events.each(&block)
end

#each_fatal_error(&block) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



1624
1625
1626
# File 'lib/roby/execution_engine.rb', line 1624

def each_fatal_error(&block)
    fatal_errors.each(&block)
end

#each_framework_error(&block) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



1664
1665
1666
# File 'lib/roby/execution_engine.rb', line 1664

def each_framework_error(&block)
    framework_errors.each(&block)
end

#each_free_events_errors(&block) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



1640
1641
1642
# File 'lib/roby/execution_engine.rb', line 1640

def each_free_events_errors(&block)
    free_events_errors.each(&block)
end

#each_handled_error(&block) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



1648
1649
1650
# File 'lib/roby/execution_engine.rb', line 1648

def each_handled_error(&block)
    handled_errors.each(&block)
end

#each_inhibited_error(&block) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



1656
1657
1658
# File 'lib/roby/execution_engine.rb', line 1656

def each_inhibited_error(&block)
    inhibited_errors.each(&block)
end

#each_nonfatal_error(&block) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



1632
1633
1634
# File 'lib/roby/execution_engine.rb', line 1632

def each_nonfatal_error(&block)
    nonfatal_errors.each(&block)
end

#exceptionsObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Return the exception objects registered in this result object



1620
1621
1622
# File 'lib/roby/execution_engine.rb', line 1620

def exceptions
    fatal_errors.map(&:first) + nonfatal_errors.map(&:first) + free_events_errors.map(&:first)
end

#has_called_generators?Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Boolean)


1607
1608
1609
# File 'lib/roby/execution_engine.rb', line 1607

def has_called_generators?
    !called_generators.empty?
end

#has_emitted_events?Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Boolean)


1615
1616
1617
# File 'lib/roby/execution_engine.rb', line 1615

def has_emitted_events?
    !emitted_events.empty?
end

#has_fatal_errors?Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Boolean)


1628
1629
1630
# File 'lib/roby/execution_engine.rb', line 1628

def has_fatal_errors?
    !fatal_errors.empty?
end

#has_framework_errors?Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Boolean)


1668
1669
1670
# File 'lib/roby/execution_engine.rb', line 1668

def has_framework_errors?
    !framework_errors.empty?
end

#has_free_events_errors?Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Boolean)


1644
1645
1646
# File 'lib/roby/execution_engine.rb', line 1644

def has_free_events_errors?
    !free_events_errors.empty?
end

#has_handled_errors?Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Boolean)


1652
1653
1654
# File 'lib/roby/execution_engine.rb', line 1652

def has_handled_errors?
    !handled_errors.empty?
end

#has_inhibited_errors?Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Boolean)


1660
1661
1662
# File 'lib/roby/execution_engine.rb', line 1660

def has_inhibited_errors?
    !inhibited_errors.empty?
end

#has_nonfatal_errors?Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Boolean)


1636
1637
1638
# File 'lib/roby/execution_engine.rb', line 1636

def has_nonfatal_errors?
    !nonfatal_errors.empty?
end

#merge(results) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
# File 'lib/roby/execution_engine.rb', line 1583

def merge(results)
    self.called_generators.merge(results.called_generators)
    self.emitted_events.merge(results.emitted_events)
    self.kill_tasks.merge(results.kill_tasks)
    self.fatal_errors.concat(results.fatal_errors)
    self.nonfatal_errors.concat(results.nonfatal_errors)
    self.free_events_errors.concat(results.free_events_errors)
    self.handled_errors.concat(results.handled_errors)
    self.inhibited_errors.concat(results.inhibited_errors)
    self.framework_errors.concat(results.framework_errors)
end

#pretty_print(pp) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
# File 'lib/roby/execution_engine.rb', line 1676

def pretty_print(pp)
    unless emitted_events.empty?
        pp.text "received #{emitted_events.size} events:"
        pp.nest(2) do
            emitted_events.each do |ev|
                pp.breakable
                ev.pretty_print(pp)
            end
        end
    end
    exceptions = self.exceptions
    unless exceptions.empty?
        pp.breakable unless emitted_events.empty?
        pp.text "#{exceptions.size} unhandled exceptions:"
        pp.nest(2) do
            exceptions.map do |e|
                pp.breakable
                e.pretty_print(pp)
            end
        end
    end
    unless handled_errors.empty?
        pp.breakable if !emitted_events.empty? || !exceptions.empty?
        pp.text "#{handled_errors.size} handled exceptions:"
        pp.nest(2) do
            handled_errors.each do |e, handled_by|
                pp.breakable
                e.pretty_print(pp)
                pp.breakable
                pp.text "Handled by:"
                pp.nest(2) do
                    handled_by.each do |t|
                        pp.breakable
                        t.pretty_print(pp)
                    end
                end
            end
        end
    end
    unless framework_errors.empty?
        pp.breakable if !emitted_events.empty? || !exceptions.empty? || !handled_errors.empty?
        pp.text "#{framework_errors.size} framework errors"
        pp.nest(2) do
            framework_errors.each do |e, source|
                pp.breakable
                pp.text "from #{source}: "
                e.pretty_print(pp)
            end
        end
    end
end