Make sure metric handlers are fired first
See original GitHub issueHi,
I noticed that since event handlers are invoked at the order of their insertion, there’s a potential bug- if a metric handler is inserted after a TensorBoard handler, the metric value will not be ready at the time of writing.
While this has only minor effects (one epoch shift in the results), I think it can be easily solved by one of two approaches:
- separating handlers list to two: one for metrics, and the other handler types.
- More generic and scalable- allowing users to decide the order of execution by adding priority argument to
add_event_handler
(default would be that metric handlers are inserted with higher priority) and then sort the list whenrun()
is invoked.
Let me know if you like any of the ideas, and I’d be happy to draft a PR
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:7 (2 by maintainers)
Top Results From Across the Web
The Order of Multiple Event Listeners - Stack Overflow
The order in which event handlers are fired was not guaranteed by the DOM events stuff originally (but keep reading). From the DOM2...
Read more >Apollo Server plugin event reference - Apollo GraphQL Docs
This helps you make sure all of your server's dependencies are available before attempting to begin serving requests. This event is fired at...
Read more >Event listeners not working? 3 key areas to troubleshoot
Are your event listeners not working as you'd expect? Here are 3 key areas to troubleshoot to help you get everything triggering as...
Read more >Towards a better responsiveness metric - web.dev
We want to make sure our metric captures the full amount of time a user has to wait for a response when tapping,...
Read more >21 Employee Performance Metrics - AIHR
As a side-note: when you have selected your relevant metrics, make sure to include them in a tactical HR dashboard or in your...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I think this is a general question. We should decide, whether we want priorities/sorting of handlers or not (but definitely not support both versions).
If we implement it, it should always be used, but this may also introduce unwanted behaviour if some handlers are for example added by an internal function with a different priority, this may also confuse the user, since he might expect some other behaviour.
I think, I slightly prefer the way including priorities, but this has to be carefully implemented. On the implementation side, I would prefer to have the priority option not in the function adding the handler but as an attribute of the handler (comparable to the logging level in python’s internal logging module).
Yes it requires a new handler class but also some code that allows all current handler implementations to continue working by providing good defaults and wrapping possibilities