TelemetryProducer
calls state change hook methods regardless of state change
#483
Labels
area: api
Issues related to API changes
area: telemetry
Issues related to dashboard telemetry
bug: minor
A minor bug
type: refactor
Issues focused on refactoring existing code
This is a breakout ticket from #460 regarding this review comment
Description
As part of #460 a
TelemetryProducer
class was added to allow for more fine grain control over which specific SmartSim entity instances should be producing telemetry output. To do this, entities simply instance anTelemetryProducer
as an instance attr and then itself if just a class to track the state of a flag.In order for entities to be able to react to a change in the flag output, developers can subclass the
TelemetryProducer
and override two hook methods:on_enable
andon_disable
. These methods were intended to be called when the state of the flag changed. However the current implementation calls them on each.enable()
/.disable()
call respectively, regardless of if the flag state change.This implementation here is fairly trivial, but was leading to to some failures in #460 that we did not want to lump into that PR. They should be investigated on their own as it could be emblematic of a larger existing problem already existing in the SmartSim codebase.
How to Reproduce
Consider the following repl output:
Expected Behavior
The
on_{enable,disable}
hooks should only be called when the_is_on
flag changes states:Acceptance Criteria
TelemetryProducer
derivatives behave as expectedThe text was updated successfully, but these errors were encountered: