Skip to content

Commit

Permalink
Merge pull request #15 from ebmdatalab/configurable-db-path
Browse files Browse the repository at this point in the history
Add an option to configure the db path when backfilling
  • Loading branch information
ghickman authored Nov 9, 2023
2 parents 34d304e + 8cc8c7e commit f0b076b
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions metrics/github/backfill.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,19 +123,18 @@ def next_weekday(d, weekday):
@click.command()
@click.argument("org")
@click.option("--pull-data", is_flag=True, default=False)
@click.option("--db-path", type=str)
@click.pass_context
def backfill(ctx, pull_data, org):
def backfill(ctx, org, pull_data, db_path="github.db"):
"""Backfill GitHub data for the given GitHub ORG"""
db = "github.db"

if pull_data:
# clean up existing db
Path(db).unlink(missing_ok=True)
Path(db_path).unlink(missing_ok=True)

# pull all data down to make backfilling quicker
get_data(db, org)
get_data(db_path, org)

prs = get_prs(db)
prs = get_prs(db_path)

org_prs = [pr for pr in prs if pr["org"] == org]
log.info("Backfilling with %s PRs for %s", len(org_prs), org)
Expand Down

0 comments on commit f0b076b

Please sign in to comment.