raster-vision
raster-vision copied to clipboard
Avoid double registration problem
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.
Also reported on Gitter today: https://gitter.im/azavea/raster-vision?at=62ec8910f4d7a323deca075e