Add sample_random_scans script and first-page list-scans option
- scripts/sample_random_scans.sh: pick a random scan per machine (default: first list page) and download mosaic and/or tiles - --list-scans-first-page-only: one HTTP request for scan list (up to 320 IDs) - scripts/machines.example.txt; .gitignore local machines.txt (copy from example) - README: document usage
This commit is contained in:
+17
-5
@@ -77,16 +77,28 @@ class MachineSession:
|
||||
# Scan list (paginated)
|
||||
# ------------------------------------------------------------------
|
||||
|
||||
def get_all_scans(self) -> list[dict[str, Any]]:
|
||||
def get_all_scans(
|
||||
self, first_page_only: bool = False
|
||||
) -> list[dict[str, Any]]:
|
||||
"""
|
||||
Fetch the complete scan list across all pages.
|
||||
Fetch the scan list from the RootView table.
|
||||
|
||||
Uses a large FilterCount (320) to minimise round-trips.
|
||||
Falls back to repeated pages if the list is longer.
|
||||
By default, walks all pages. With first_page_only=True, only the first
|
||||
request is made (FilterCount 320) — enough for a random pick without
|
||||
paginating a large history.
|
||||
"""
|
||||
page_size = 320
|
||||
if first_page_only:
|
||||
all_scans = self._fetch_scan_page(0, page_size)
|
||||
log.info(
|
||||
"[%s] First page only: %d scan(s) (not paginating).",
|
||||
self.machine["label"],
|
||||
len(all_scans),
|
||||
)
|
||||
return all_scans
|
||||
|
||||
all_scans: list[dict[str, Any]] = []
|
||||
start = 0
|
||||
page_size = 320
|
||||
|
||||
while True:
|
||||
page_scans = self._fetch_scan_page(start, page_size)
|
||||
|
||||
Reference in New Issue
Block a user