Skip to content

Commit

Permalink
Record scan region in scan db
Browse files Browse the repository at this point in the history
  • Loading branch information
ghostwords committed Nov 19, 2024
1 parent 00d459a commit f9af908
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions initdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,12 @@ def get_browser(log_txt):
return None

# pylint: disable-next=too-many-arguments
def get_scan_id(cur, start_time, end_time, num_sites, browser, no_blocking, daily_scan):
# TODO also record region we're scanning from
# TODO and the list we're scanning against
cur.execute("INSERT INTO scan (start_time, end_time, num_sites, "
def get_scan_id(cur, start_time, end_time, region, num_sites, browser, no_blocking, daily_scan):
# TODO also record the list we're scanning against
cur.execute("INSERT INTO scan (start_time, end_time, region, num_sites, "
"browser_id, no_blocking, daily_scan) "
"VALUES (?,?,?,?,?,?)", (start_time, end_time, num_sites,
"VALUES (?,?,?,?,?,?,?)", (
start_time, end_time, region, num_sites,
browsers[browser], no_blocking, daily_scan))
return cur.lastrowid

Expand All @@ -65,6 +65,7 @@ def create_tables(cur):
id INTEGER PRIMARY KEY AUTOINCREMENT,
start_time TIMESTAMP NOT NULL,
end_time TIMESTAMP NOT NULL,
region VARCHAR(4) NOT NULL,
num_sites INTEGER NOT NULL,
browser_id INTEGER NOT NULL,
no_blocking BOOLEAN NOT NULL CHECK (no_blocking IN (0, 1)),
Expand Down Expand Up @@ -185,6 +186,7 @@ def ingest_distributed_scans(badger_swarm_dir, cur):
continue

scan_id = get_scan_id(cur, start_time, end_time,
run_settings['do_region'],
run_settings['num_sites'],
run_settings['browser'],
True, False)
Expand Down Expand Up @@ -237,7 +239,7 @@ def ingest_daily_scans(cur):
if cur.fetchone():
return

scan_id = get_scan_id(cur, start_time, end_time, num_sites,
scan_id = get_scan_id(cur, start_time, end_time, "sfo1", num_sites,
browser, no_blocking, True)

results = json.loads(run(f"git show {rev}:results.json".split(" ")))
Expand Down

0 comments on commit f9af908

Please sign in to comment.