raster-vision icon indicating copy to clipboard operation
raster-vision copied to clipboard

Avoid double registration problem

Open lewfish opened this issue 4 years ago • 1 comments

When putting the get_config function in the same module as the Pipeline and PipelineConfig, we got a RegistryError, saying that the type_hint had already been registered. I'm not sure why this was triggered in this situation, but there may be an easy way around it. Currently, we check that the type_hint hasn't been registered before (to catch mistakes where someone uses the same type_hint twice). This is good, but it leads to an error if the module gets imported twice. Hopefully we can avoid that problem if we only raise an error if the type hint and value (ie. the Config class) have already been registered.

Thanks to @echeipesh for this idea.

lewfish avatar Sep 14 '20 17:09 lewfish

Also reported on Gitter today: https://gitter.im/azavea/raster-vision?at=62ec8910f4d7a323deca075e

AdeelH avatar Aug 05 '22 08:08 AdeelH