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 = Array.new, nonfatal_errors = Array.new, free_events_errors = Array.new, handled_errors = Array.new, inhibited_errors = Array.new, framework_errors = Array.new) ⇒ 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.



1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
# File 'lib/roby/execution_engine.rb', line 1464

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

    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



1463
1464
1465
# File 'lib/roby/execution_engine.rb', line 1463

def called_generators
  @called_generators
end

#emitted_eventsObject

Returns the value of attribute emitted_events

Returns:

  • (Object)

    the current value of emitted_events



1463
1464
1465
# File 'lib/roby/execution_engine.rb', line 1463

def emitted_events
  @emitted_events
end

#fatal_errorsObject

Returns the value of attribute fatal_errors

Returns:

  • (Object)

    the current value of fatal_errors



1463
1464
1465
# File 'lib/roby/execution_engine.rb', line 1463

def fatal_errors
  @fatal_errors
end

#framework_errorsObject

Returns the value of attribute framework_errors

Returns:

  • (Object)

    the current value of framework_errors



1463
1464
1465
# File 'lib/roby/execution_engine.rb', line 1463

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



1463
1464
1465
# File 'lib/roby/execution_engine.rb', line 1463

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



1463
1464
1465
# File 'lib/roby/execution_engine.rb', line 1463

def handled_errors
  @handled_errors
end

#inhibited_errorsObject

Returns the value of attribute inhibited_errors

Returns:

  • (Object)

    the current value of inhibited_errors



1463
1464
1465
# File 'lib/roby/execution_engine.rb', line 1463

def inhibited_errors
  @inhibited_errors
end

#kill_tasksObject

Returns the value of attribute kill_tasks

Returns:

  • (Object)

    the current value of kill_tasks



1463
1464
1465
# File 'lib/roby/execution_engine.rb', line 1463

def kill_tasks
  @kill_tasks
end

#nonfatal_errorsObject

Returns the value of attribute nonfatal_errors

Returns:

  • (Object)

    the current value of nonfatal_errors



1463
1464
1465
# File 'lib/roby/execution_engine.rb', line 1463

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.



1501
1502
1503
# File 'lib/roby/execution_engine.rb', line 1501

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.



1574
1575
1576
# File 'lib/roby/execution_engine.rb', line 1574

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.



1497
1498
1499
# File 'lib/roby/execution_engine.rb', line 1497

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.



1505
1506
1507
# File 'lib/roby/execution_engine.rb', line 1505

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.



1513
1514
1515
# File 'lib/roby/execution_engine.rb', line 1513

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.



1526
1527
1528
# File 'lib/roby/execution_engine.rb', line 1526

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.



1566
1567
1568
# File 'lib/roby/execution_engine.rb', line 1566

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.



1542
1543
1544
# File 'lib/roby/execution_engine.rb', line 1542

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.



1550
1551
1552
# File 'lib/roby/execution_engine.rb', line 1550

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.



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

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.



1534
1535
1536
# File 'lib/roby/execution_engine.rb', line 1534

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



1522
1523
1524
# File 'lib/roby/execution_engine.rb', line 1522

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)


1509
1510
1511
# File 'lib/roby/execution_engine.rb', line 1509

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)


1517
1518
1519
# File 'lib/roby/execution_engine.rb', line 1517

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)


1530
1531
1532
# File 'lib/roby/execution_engine.rb', line 1530

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)


1570
1571
1572
# File 'lib/roby/execution_engine.rb', line 1570

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)


1546
1547
1548
# File 'lib/roby/execution_engine.rb', line 1546

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)


1554
1555
1556
# File 'lib/roby/execution_engine.rb', line 1554

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)


1562
1563
1564
# File 'lib/roby/execution_engine.rb', line 1562

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)


1538
1539
1540
# File 'lib/roby/execution_engine.rb', line 1538

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.



1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
# File 'lib/roby/execution_engine.rb', line 1485

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.



1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
# File 'lib/roby/execution_engine.rb', line 1578

def pretty_print(pp)
    if !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
    if !exceptions.empty?
        pp.breakable if !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
    if !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
    if !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