https://github.com/jvivian/one_off_scripts
Raw File
Tip revision: 3ad04be99cd01e6a047c1b530cc8a1de82bd862e authored by John Vivian on 02 February 2017, 01:31:18 UTC
Refactor SRA pipeline to use faster method than fastq-dump
Tip revision: 3ad04be
delete_sdb_artifacts.py
import boto.sdb
import boto

db = boto.sdb.connect_to_region('us-west-2')
conn = boto.connect_s3()

domains = {domain.name: domain for domain in db.get_all_domains() if domain.name.endswith('--files')}
buckets = {bucket.name: bucket for bucket in conn.get_all_buckets() if bucket.name.endswith('--files')}

diff = set(domains.keys()).difference(set(buckets.keys()))

for domain in diff:
    job = domain.replace('--files', '--jobs')
    domains[domain].delete()
    domains[job].delete()
back to top