Skip to content

Commit 3a02268

Browse files
committed
fix: search subdeployments under parent, fix USGS Water station key
1 parent 92f584b commit 3a02268

2 files changed

Lines changed: 7 additions & 2 deletions

File tree

publishers/bootstrap_helpers.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,12 @@ def ensure_deployment(base_url: str, auth: str, uid: str, body: dict,
349349
parent_id: str | None = None,
350350
*, dry_run: bool = False, stats: dict = None) -> str | None:
351351
"""Create a deployment node if it doesn't exist. Returns server ID."""
352+
# Check top-level deployments first
352353
existing = find_by_uid(base_url, auth, "deployments", uid)
354+
if not existing and parent_id:
355+
# Go server only lists subdeployments under parent endpoint
356+
existing = find_by_uid(base_url, auth,
357+
f"deployments/{parent_id}/subdeployments", uid)
353358
if existing:
354359
print(f" [SKIP] Deployment {uid} already exists (id={existing})")
355360
if stats:

publishers/usgs_water/bootstrap_usgs_water.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -840,14 +840,14 @@ def bootstrap(*, clean: bool = False, clean_only: bool = False,
840840
if "00060" in st.get("parameterCodes", []):
841841
ensure_datastream(base_url, auth, sys_id or "pending",
842842
DS_DISCHARGE_OUTPUT,
843-
_discharge_datastream_schema(st["id"]),
843+
_discharge_datastream_schema(nwis_id),
844844
dry_run=dry_run, stats=stats)
845845

846846
# Create gage height datastream
847847
if "00065" in st.get("parameterCodes", []):
848848
ensure_datastream(base_url, auth, sys_id or "pending",
849849
DS_GAGE_HEIGHT_OUTPUT,
850-
_gage_height_datastream_schema(st["id"]),
850+
_gage_height_datastream_schema(nwis_id),
851851
dry_run=dry_run, stats=stats)
852852

853853
# -- Deployment tree --

0 commit comments

Comments
 (0)