Allow checkpointed AOI-specific provisioning
This commit is contained in:
@@ -253,12 +253,23 @@ def main() -> int:
|
|||||||
parser.add_argument("--side-m", type=float, default=256.0)
|
parser.add_argument("--side-m", type=float, default=256.0)
|
||||||
parser.add_argument("--resolution-m", type=float, default=0.25)
|
parser.add_argument("--resolution-m", type=float, default=0.25)
|
||||||
parser.add_argument("--force-refresh", action="store_true")
|
parser.add_argument("--force-refresh", action="store_true")
|
||||||
|
parser.add_argument(
|
||||||
|
"--only-slug",
|
||||||
|
action="append",
|
||||||
|
default=[],
|
||||||
|
help="Provision only the named AOI slug; repeat to select multiple AOIs.",
|
||||||
|
)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"--session-token-file",
|
"--session-token-file",
|
||||||
type=Path,
|
type=Path,
|
||||||
help="Read an operator session token from a local mode-0600 file instead of exposing it on the command line.",
|
help="Read an operator session token from a local mode-0600 file instead of exposing it on the command line.",
|
||||||
)
|
)
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
known_slugs = {aoi.slug for aoi in AOIS}
|
||||||
|
unknown_slugs = sorted(set(args.only_slug) - known_slugs)
|
||||||
|
if unknown_slugs:
|
||||||
|
raise SystemExit(f"Unknown --only-slug value(s): {', '.join(unknown_slugs)}")
|
||||||
|
selected_aois = tuple(aoi for aoi in AOIS if not args.only_slug or aoi.slug in args.only_slug)
|
||||||
session = requests.Session()
|
session = requests.Session()
|
||||||
if args.session_token_file:
|
if args.session_token_file:
|
||||||
token = args.session_token_file.read_text(encoding="utf-8").strip()
|
token = args.session_token_file.read_text(encoding="utf-8").strip()
|
||||||
@@ -273,7 +284,7 @@ def main() -> int:
|
|||||||
if "sample_slug" not in sample and sample.get("slug"):
|
if "sample_slug" not in sample and sample.get("slug"):
|
||||||
sample["sample_slug"] = sample.pop("slug")
|
sample["sample_slug"] = sample.pop("slug")
|
||||||
completed = {str(sample.get("sample_slug") or sample.get("slug")) for sample in samples}
|
completed = {str(sample.get("sample_slug") or sample.get("slug")) for sample in samples}
|
||||||
for aoi in AOIS:
|
for aoi in selected_aois:
|
||||||
if aoi.slug in completed:
|
if aoi.slug in completed:
|
||||||
print(f"{aoi.slug}: checkpoint reused", flush=True)
|
print(f"{aoi.slug}: checkpoint reused", flush=True)
|
||||||
continue
|
continue
|
||||||
|
|||||||
Reference in New Issue
Block a user