@@ -0,0 +1,1034 @@
+import os%0Afrom django.core.management.base import BaseCommand%0Aimport datetime%0A%0Adef run(cmd):%0A    print(cmd)%0A    os.system(cmd)%0A%0A%0Aclass Command(BaseCommand):%0A    help = 'Run database backups.'%0A%0A    def add_arguments(self, parser):%0A        parser.add_argument('--postgres-host', default=os.environ.get('POSTGRES_SERVICE_HOSTNAME', 'unknown'))%0A%0A    def handle(self, *args, **options):%0A        timestamp = datetime.datetime.now().strftime(%22%25Y-%25m-%25d__%25H-%25M-%25S%22)%0A%0A        print(%22=====================================%22)%0A        print(%22======== %25s ======= %22 %25 timestamp)%0A        print(%22=====================================%22)%0A%0A        backup_filename = 'gene_reference_data_backup.gz'%0A%0A        run(%22/usr/bin/pg_dump -U postgres --table='reference_*' --host %7Bpostgres_host%7D seqrdb %7C gzip -c - %3E %7Bbackup_filename%7D%22.format(%0A            postgres_host=options%5B'postgres_host'%5D, backup_filename=backup_filename%0A        ))%0A        run(%22gsutil mv %7Bbackup_filename%7D gs://seqr-reference-data/%7Bbackup_filename%7D%22.format(backup_filename=backup_filename))%0A

add reference data backup command