Skip to content
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

obs_base don't create calib repo if it does not exist #25

Merged
merged 1 commit into from Mar 18, 2017

Conversation

n8pease
Copy link
Contributor

@n8pease n8pease commented Mar 17, 2017

No description provided.

else:
if dafPersist.Storage.exists(uri=calibRoot):
calibStorage = dafPersist.Storage.makeFromURI(uri=calibRoot)
if not calibStorage:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do you mean if calibStorage is not None: here?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree that the negation is slightly confusing here. It would be better to test explicitly against None.

The problem is that "old" butler init API is translated to "new" butler API to
create an output repository with mode = 'rw'. The result is that butler will
create the storage (directory, in the case of a posix repository) if the
directory does not exist. CameraMapper has both a 'root' repo and a 'calib'
repo, so there are 2 storages associated with it.

This was causing a race condition in obs_subaru: tests in multiple files are
using the mapper with root=".", and they are only reading (I hope) from the
mapper.
But for these tests the calib repo does not exist on disk and is not required
for the test. But HscMapper (CameraMapper subclass) will init CameraMapper with
calibRoot='CALIB' if no other calibRoot is specified.
So CameraMapper was causing Storage to create the calib storage folder, and
when multiple tests were running this exposed a race condition where two tests
could be calling makedirs at the same time.
This fix causes CameraMapper to not create a CALIB folder if the storage does
not exist, which is fine: CameraMapper does not write to the CALIB folder.
The totally correct fix would be for CameraMapper subclasses to not pass in a
calibRoot if they don't expect it to exist.
Also, in daf_persistence, makedirs was changed to safeMakeDir, which would
prevent the crash but would allow the tests to leave CALIB folders sprinkled
around which would not be good.
@n8pease n8pease merged commit e30d6a6 into master Mar 18, 2017
@ktlim ktlim deleted the tickets/DM-9848 branch August 25, 2018 06:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants