Open luowyang opened 2 months ago
Hi @luowyang, thanks for the detailed request ! What do you think about having an API that register custom tracker @muellerzr ?
Sure. I'd be open to this. However we can make name
a class attribute (they already are) so the API is just:
accelerator.register_tracker_class(CustomTracker)
How does that sound :)
Currently
accelerate
maintains an internal known tracker registryLOGGER_TYPE_TO_CLASS
, which is used for tracker initializing, filtering, among other things. However, this makes working with custom trackers annoying in user code. One such example is when initializing custom trackers, instead of something likeone has to write:
This is annoying in that users have to write many boilerplate code to manage the init args of both custom trackers and built-in trackers in one place. If the users can register their custom trackers into
LOGGER_TYPE_TO_CLASS
, it will be possible to initialize the custom trackers in the same (and uniform) way as the built-in trackers by:The API for registering custom trackers could be something like:
I have examined the source code, and there seems no obstacle in doing so, as long as the
GeneralTracker
protocol is obeyed by the custom trackers. To make sure of it, it may be beneficial to markGeneralTracker
as an abstract base class, though.