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
Bagit export updates #677
Bagit export updates #677
Conversation
It seems that our BagIt export (at least for now) is going to be strictly for the purpose of getting transcription data into www.loc.gov. The most recent changes make it even more LC-specific. When we are ready to talk about/implement public exports, I'm not sure that BagIt 1.0 bags are what we want to use. I think the CSV export is better, not the least of which is because it's a streaming response that won't OOM on large exports. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to apply published checks here to exclude the campaign/project/item/asset(s) which aren't published yet?
exporter/views.py
Outdated
@@ -35,13 +37,81 @@ def get_original_asset_id(download_url): | |||
""" | |||
if download_url.startswith("http://tile.loc.gov/"): | |||
pattern = r"/service:([A-Za-z0-9:\-]*)/" | |||
asset_id = re.search(pattern, download_url) | |||
asset_id = re.search(pattern, download_url).group(1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will fail if it gets a value which doesn't match the pattern. We should probably do the if not match: …
check even if that's unlikely.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I changed it - let me know what you think.
I suspect that the best answer here is going to be Celery and the work on bagit-python to make it upload directly to S3 (and that could be safely made public with some sort of throttle). That's definitely a separate project but we might want to see whether there's something we can do here to avoid OOMs — do you know where in the code it's hitting that limit? |
Co-Authored-By: rstorey <rstorey@users.noreply.github.com>
Co-Authored-By: rstorey <rstorey@users.noreply.github.com>
Co-Authored-By: rstorey <rstorey@users.noreply.github.com>
Co-Authored-By: rstorey <rstorey@users.noreply.github.com>
Co-Authored-By: rstorey <rstorey@users.noreply.github.com>
Co-Authored-By: rstorey <rstorey@users.noreply.github.com>
Co-Authored-By: rstorey <rstorey@users.noreply.github.com>
Co-Authored-By: rstorey <rstorey@users.noreply.github.com>
I haven't actually personally witnessed an OOM, so not sure. |
SInce we're only getting completed transcriptions in the BagIt export, either the assets are published or were published. I think the scenario where something is published, completed, unpublished, and then exported might be a valid use case, so I'm not going to add a filter for publish status at this time. If @elainekamlley wants to weigh in, I defer to them. |
logger.error( | ||
"Couldn't find a matching asset ID in download URL %s", download_url | ||
) | ||
raise AssertionError |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could be some other exception class but I care less about that than that it’s checked since it seems like this condition will usually be telling us that we got some bogus data from the API, and that edge case probably means we need to get some records fixed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I’m cutting my review short for family reasons but it looks good enough to me to merge for testing
Closes #664