flatironinstitute / kachery-cloud

Apache License 2.0
20 stars 4 forks source link

Enhancement: Warn user if client id does not match cached info #25

Closed samuelbray32 closed 8 months ago

samuelbray32 commented 8 months ago

https://github.com/flatironinstitute/kachery-cloud/blob/e5dd5fb57d4aa556f4a43523e0324bc472390c17/kachery_cloud/init.py#L28C1-L28C7

In some use cases, user code may change the environment variable KACHERY_CLOUD_DIR during execution. This can lead to a mismatch between the return information of get_client_id() (which is used to construct payload requests) and get_client_info() (which is used in init()) if there is a different previously cached value in _global_init. See this issue for example.

Suggestion:

Inside of get_client_info(), if there is a cahced value in _global_init, check that the client id is the same as the returned value from get_client_id(). If not, log a warning to help users debug.

magland commented 8 months ago

Sounds reasonable @samuelbray32. Would you be willing to create a PR for that?