forked from Signbank/FinSL-signbank
-
Notifications
You must be signed in to change notification settings - Fork 0
CC-2305: Management commands for healing Video file S3<->Postgres relationships #180
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
Open
jonholdsworth
wants to merge
238
commits into
master
Choose a base branch
from
CCSD-2305-nzsl-production-uat-database-backport
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
CC-2305: Management commands for healing Video file S3<->Postgres relationships #180
jonholdsworth
wants to merge
238
commits into
master
from
CCSD-2305-nzsl-production-uat-database-backport
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Turns out setting up to use either path based or native is very un-simple. Try if necessary another time. This reverts commit c4ecdcb.
I have made all 3 scripts into Django Management Commands. |
This was never merged! |
@G-Rath I believe this can be merged. The github ignores could possibly be removed, or can be addressed separately. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Adds management commands to resolve discrepancies between NZSL Signbank's Postgres database and Amazon S3 file storage.
Jira ticket
CC-2305 NZSL Signbank: UAT database backport
Changes
These management commands are used to report on relationships between Signbank's Postgres database and Amazon's S3 file storage, and then assist with effecting some types of repair where discrepancies exist. See documentation.
These commands only perform certain actions, other operations have to be manually commanded using AWS
cli
or other means, using the output from these commands as data. See documentation.Boto3
python library to talk to AWS S3.The commands require, usually in the environment:
AWS_PROFILE
environment variable set to a pre-configured profile.DATABASE_URL
environment variable with target and credentials.The commands have some common arguments:
--help
or-h
- emit a Help message showing the available arguments.--env
- specifies the target environment, eg.dev
,uat
,production
. This is used to contruct the name of the AWS S3 bucket name, eg.nzsl-signbank-media-uat
. The default isuat
.--pgcli
- allows the user to specify a different path for the Postgres command-line client. The default is/usr/bin/psql
.Commands
get-video-s3-acls
This command produces a full report on NZSL vs S3.
It outputs as CSV, with headers.
find-fixable-s3-orphans
This command accesses the database and S3 in a similar way to
get-video-s3-acls.py
.It finds S3 objects that have no corresponding NZSL Signbank database record. These are 'orphaned' S3 objects.
It then parses the name string of the object and attempts to find an NZSL Signbank record that matches it. This is not guaranteed to be correct, so the output needs human review.
It outputs what it finds as CSV with header, in a format that can be digested by the 3rd command
repair-fixable-s3-orphans.py
.repair-fixable-s3-orphans
This attempts to unify NZSL Signbank records with S3 orphans, by digesting a CSV input of the same format as output by
find-fixable-orphans.py
. It does this by generatingGlossVideo
Django objects where necessary, and associating them with the correctGloss
Django objects. This operation changes the database contents and so must be used with caution.