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

reference form attachments in case attachments instead of copying #13200

Merged
merged 6 commits into from
Sep 13, 2016

Conversation

snopoke
Copy link
Contributor

@snopoke snopoke commented Sep 12, 2016

@run_with_all_backends
def test_case_attachment(self):
single_attach = 'fruity_file'
xform, case = self._doCreateCaseWithMultimedia(attachments=[single_attach])
Copy link
Contributor

Choose a reason for hiding this comment

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

This sends attachments to submit_form_locally, which I would expect to work. I thought case attachments were working, but still stored in couch. Is that not true?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Case attachments come from form attachments hence the call to
submit_form_locally

response, form, cases = submit_form_locally(
xml_data,
TEST_DOMAIN_NAME,
attachments=dict_attachments,
last_sync_token=sync_token,
received_on=date
)
.

The SQL backend uses the blobdb for all attachments (form and case).
Currently we duplicate form attachments for cases so one thing we could
consider is just referencing the same blob in both the form and case.

I also see that boto S3 has a copy API method which we could also use
rather than doing a read and then write.

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm trying out the copy API right now. Will have a PR soon, hopefully.

Copy link
Contributor

Choose a reason for hiding this comment

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

@snopoke snopoke changed the title failing test for case attachments make case attachments work with S3 blob db Sep 13, 2016
@snopoke snopoke changed the title make case attachments work with S3 blob db reference form attachments in case attachments instead of copying Sep 13, 2016
with trap_extra_setup(AttributeError, msg="S3_BLOB_DB_SETTINGS not configured"):
config = settings.S3_BLOB_DB_SETTINGS
self.s3db = TemporaryS3BlobDB(config)
assert get_blob_db() is self.s3db, (get_blob_db(), self.s3db)
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: the above two lines don't need to (and probably shouldn't) be in the with trap_extra_setup block.

@millerdev
Copy link
Contributor

👍 on ✅

@snopoke
Copy link
Contributor Author

snopoke commented Sep 13, 2016

@millerdev millerdev merged commit d77cf4f into master Sep 13, 2016
@millerdev millerdev deleted the sk/copy_blob branch September 13, 2016 19:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants