-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Environment / state issues when looking up paths from two different releases #34
Comments
I can reproduce this issue, although I don't have an explanation:
Output:
|
@havok2063 can you have a look at this? It looks like one instance is leaking into the other via the value of the tree version, so the first method call to path_dr17.full() correctly uses dr17 for the tree version, whereas the same instance (i.e. path_dr17) flips to using sdsswork in the second call to path_dr17.full(). |
Hmm, I think the tree instance is in the global namespace of the package but it should be re-generated on each instance of |
I can also reproduce the error. I also found a similar error with the
|
So this is not as trivial as it seems. The way Tree works is to load the environment variable definitions into the user's Python
I think to redesign this would require a fundamental change to how |
Thanks for looking into this. I understand, and it would explain the behaviour. I'm fine for leaving the functionality as-is for a while, but long term I think this is something that should be changed. If we had each At the moment it fails silently by giving the user an incorrect path. In many cases it might be obvious that the path is incorrect because no file exists, but I can easily imagine situations where a user is loading data from one data release (e.g., IPL-1) and another data release (e.g., IPL-2). In that situation, both files would exist and the wrong file would be silently accessed by the path. For anything use case where data are being accessed from different releases (e.g., DR17 processing in Astra), the current behaviour means either replanting I'd be happy to help make changes to What do you think? Do you think we should leave the behaviour as-is indefinitely, or is this something that should be changed (on some unspecified timescale)? |
I think what you suggest would actually create a tighter dependency between the There are use cases we need to retain:
The current implementation of So I would suggest we leave the behavior as it is currently. However, I think we could perform a check when a path is generated to check the path matches the tree/release set and raise an exception when a mismatch occurs. We could also implement a flag on instantiation of |
I'm routinely looking up paths for SDSS-5 data and SDSS-4 data.
I use a dictionary to lookup instances of
SDSSPath(...)
so that I don't have to create aSDSSPath
object every time I evaluate a path. It looks something like this:But I am encountering very weird behaviour, which I can only conclude must be because of either a strange state issue, or because
sdss_access
is changing environment variables behind the scenes.Here is a minimum reproducible example:
Here is the output:
Is this the intended behaviour?
I assumed each instance would evaluate paths for that particular release, and that evaluating one path on a different instance would not impact existing instances. Note that this happens even if the second
SDSSPath(...)
is created in a totally unrelated scope, which makes me think there is some state sharing withinsdss_access
, or environment variables being changed.The text was updated successfully, but these errors were encountered: