forcingkit 0.15.0__tar.gz → 0.15.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {forcingkit-0.15.0 → forcingkit-0.15.1}/PKG-INFO +1 -1
- {forcingkit-0.15.0 → forcingkit-0.15.1}/docs/source/conf.py +1 -1
- {forcingkit-0.15.0 → forcingkit-0.15.1}/pyproject.toml +1 -1
- {forcingkit-0.15.0 → forcingkit-0.15.1}/service/forcingkit_serve/jobs.py +9 -0
- {forcingkit-0.15.0 → forcingkit-0.15.1}/service/forcingkit_serve/main.py +16 -2
- {forcingkit-0.15.0 → forcingkit-0.15.1}/service/forcingkit_serve/routers/viewer.py +4 -0
- {forcingkit-0.15.0 → forcingkit-0.15.1}/tests/unit/test_jobs.py +69 -0
- {forcingkit-0.15.0 → forcingkit-0.15.1}/uv.lock +1 -1
- {forcingkit-0.15.0 → forcingkit-0.15.1}/.agents/forcingkit.md +0 -0
- {forcingkit-0.15.0 → forcingkit-0.15.1}/.claude/CLAUDE.md +0 -0
- {forcingkit-0.15.0 → forcingkit-0.15.1}/.env.template +0 -0
- {forcingkit-0.15.0 → forcingkit-0.15.1}/.github/copilot-instructions.md +0 -0
- {forcingkit-0.15.0 → forcingkit-0.15.1}/.github/workflows/docs.yml +0 -0
- {forcingkit-0.15.0 → forcingkit-0.15.1}/.github/workflows/publish-client.yml +0 -0
- {forcingkit-0.15.0 → forcingkit-0.15.1}/.github/workflows/publish.yml +0 -0
- {forcingkit-0.15.0 → forcingkit-0.15.1}/.github/workflows/tests.yml +0 -0
- {forcingkit-0.15.0 → forcingkit-0.15.1}/.gitignore +0 -0
- {forcingkit-0.15.0 → forcingkit-0.15.1}/.markdownlint.yaml +0 -0
- {forcingkit-0.15.0 → forcingkit-0.15.1}/.pre-commit-config.yaml +0 -0
- {forcingkit-0.15.0 → forcingkit-0.15.1}/.python-version +0 -0
- {forcingkit-0.15.0 → forcingkit-0.15.1}/AGENTS.md +0 -0
- {forcingkit-0.15.0 → forcingkit-0.15.1}/CONTRIBUTING.md +0 -0
- {forcingkit-0.15.0 → forcingkit-0.15.1}/Dockerfile +0 -0
- {forcingkit-0.15.0 → forcingkit-0.15.1}/LICENSE +0 -0
- {forcingkit-0.15.0 → forcingkit-0.15.1}/README.md +0 -0
- {forcingkit-0.15.0 → forcingkit-0.15.1}/client/LICENSE +0 -0
- {forcingkit-0.15.0 → forcingkit-0.15.1}/client/README.md +0 -0
- {forcingkit-0.15.0 → forcingkit-0.15.1}/client/pyproject.toml +0 -0
- {forcingkit-0.15.0 → forcingkit-0.15.1}/client/src/forcingkit_client/__init__.py +0 -0
- {forcingkit-0.15.0 → forcingkit-0.15.1}/client/src/forcingkit_client/client.py +0 -0
- {forcingkit-0.15.0 → forcingkit-0.15.1}/client/src/forcingkit_client/schema.py +0 -0
- {forcingkit-0.15.0 → forcingkit-0.15.1}/client/src/forcingkit_client/store.py +0 -0
- {forcingkit-0.15.0 → forcingkit-0.15.1}/client/src/forcingkit_client/trajectory.py +0 -0
- {forcingkit-0.15.0 → forcingkit-0.15.1}/client/tests/conftest.py +0 -0
- {forcingkit-0.15.0 → forcingkit-0.15.1}/client/tests/test_client.py +0 -0
- {forcingkit-0.15.0 → forcingkit-0.15.1}/client/tests/test_schema.py +0 -0
- {forcingkit-0.15.0 → forcingkit-0.15.1}/client/tests/test_trajectory.py +0 -0
- {forcingkit-0.15.0 → forcingkit-0.15.1}/client/uv.lock +0 -0
- {forcingkit-0.15.0 → forcingkit-0.15.1}/docker-compose.yml +0 -0
- {forcingkit-0.15.0 → forcingkit-0.15.1}/docs/Makefile +0 -0
- {forcingkit-0.15.0 → forcingkit-0.15.1}/docs/make.bat +0 -0
- {forcingkit-0.15.0 → forcingkit-0.15.1}/docs/requirements-docs.txt +0 -0
- {forcingkit-0.15.0 → forcingkit-0.15.1}/docs/source/_extra/CNAME +0 -0
- {forcingkit-0.15.0 → forcingkit-0.15.1}/docs/source/_static/custom.css +0 -0
- {forcingkit-0.15.0 → forcingkit-0.15.1}/docs/source/_static/forcingkit-noreaster-wind.gif +0 -0
- {forcingkit-0.15.0 → forcingkit-0.15.1}/docs/source/atmospheric_forcing.rst +0 -0
- {forcingkit-0.15.0 → forcingkit-0.15.1}/docs/source/client.rst +0 -0
- {forcingkit-0.15.0 → forcingkit-0.15.1}/docs/source/fetchers.rst +0 -0
- {forcingkit-0.15.0 → forcingkit-0.15.1}/docs/source/hycom.rst +0 -0
- {forcingkit-0.15.0 → forcingkit-0.15.1}/docs/source/index.rst +0 -0
- {forcingkit-0.15.0 → forcingkit-0.15.1}/docs/source/layered_mesh.rst +0 -0
- {forcingkit-0.15.0 → forcingkit-0.15.1}/docs/source/mesh_frames.rst +0 -0
- {forcingkit-0.15.0 → forcingkit-0.15.1}/docs/source/necofs.rst +0 -0
- {forcingkit-0.15.0 → forcingkit-0.15.1}/docs/source/nyofs.rst +0 -0
- {forcingkit-0.15.0 → forcingkit-0.15.1}/docs/source/rivers.rst +0 -0
- {forcingkit-0.15.0 → forcingkit-0.15.1}/docs/source/roadmap.rst +0 -0
- {forcingkit-0.15.0 → forcingkit-0.15.1}/docs/source/sources.rst +0 -0
- {forcingkit-0.15.0 → forcingkit-0.15.1}/docs/source/waves.rst +0 -0
- {forcingkit-0.15.0 → forcingkit-0.15.1}/main.py +0 -0
- {forcingkit-0.15.0 → forcingkit-0.15.1}/service/__init__.py +0 -0
- {forcingkit-0.15.0 → forcingkit-0.15.1}/service/forcingkit_serve/__init__.py +0 -0
- {forcingkit-0.15.0 → forcingkit-0.15.1}/service/forcingkit_serve/routers/bathymetry.py +0 -0
- {forcingkit-0.15.0 → forcingkit-0.15.1}/service/forcingkit_serve/routers/plotly_api.py +0 -0
- {forcingkit-0.15.0 → forcingkit-0.15.1}/service/forcingkit_serve/routers/removed.py +0 -0
- {forcingkit-0.15.0 → forcingkit-0.15.1}/service/forcingkit_serve/routers/stores.py +0 -0
- {forcingkit-0.15.0 → forcingkit-0.15.1}/service/forcingkit_serve/stac.py +0 -0
- {forcingkit-0.15.0 → forcingkit-0.15.1}/service/run_server.py +0 -0
- {forcingkit-0.15.0 → forcingkit-0.15.1}/src/forcingkit/__init__.py +0 -0
- {forcingkit-0.15.0 → forcingkit-0.15.1}/src/forcingkit/data/rivers/northeast_us.json +0 -0
- {forcingkit-0.15.0 → forcingkit-0.15.1}/src/forcingkit/dispatcher.py +0 -0
- {forcingkit-0.15.0 → forcingkit-0.15.1}/src/forcingkit/fetchers/coastwatch.py +0 -0
- {forcingkit-0.15.0 → forcingkit-0.15.1}/src/forcingkit/fetchers/dbofs.py +0 -0
- {forcingkit-0.15.0 → forcingkit-0.15.1}/src/forcingkit/fetchers/erddap.py +0 -0
- {forcingkit-0.15.0 → forcingkit-0.15.1}/src/forcingkit/fetchers/hrrr.py +0 -0
- {forcingkit-0.15.0 → forcingkit-0.15.1}/src/forcingkit/fetchers/hrrr_atmosphere.py +0 -0
- {forcingkit-0.15.0 → forcingkit-0.15.1}/src/forcingkit/fetchers/hrrr_levels.py +0 -0
- {forcingkit-0.15.0 → forcingkit-0.15.1}/src/forcingkit/fetchers/hrrr_points.py +0 -0
- {forcingkit-0.15.0 → forcingkit-0.15.1}/src/forcingkit/fetchers/hycom.py +0 -0
- {forcingkit-0.15.0 → forcingkit-0.15.1}/src/forcingkit/fetchers/hydrography.py +0 -0
- {forcingkit-0.15.0 → forcingkit-0.15.1}/src/forcingkit/fetchers/ndbc.py +0 -0
- {forcingkit-0.15.0 → forcingkit-0.15.1}/src/forcingkit/fetchers/necofs.py +0 -0
- {forcingkit-0.15.0 → forcingkit-0.15.1}/src/forcingkit/fetchers/noaa.py +0 -0
- {forcingkit-0.15.0 → forcingkit-0.15.1}/src/forcingkit/fetchers/nwps.py +0 -0
- {forcingkit-0.15.0 → forcingkit-0.15.1}/src/forcingkit/fetchers/nyofs.py +0 -0
- {forcingkit-0.15.0 → forcingkit-0.15.1}/src/forcingkit/fetchers/usgs.py +0 -0
- {forcingkit-0.15.0 → forcingkit-0.15.1}/src/forcingkit/fetchers/usgs_rivers.py +0 -0
- {forcingkit-0.15.0 → forcingkit-0.15.1}/src/forcingkit/layered_mesh.py +0 -0
- {forcingkit-0.15.0 → forcingkit-0.15.1}/src/forcingkit/mesh_frames.py +0 -0
- {forcingkit-0.15.0 → forcingkit-0.15.1}/src/forcingkit/ramps/currents_lis.csv +0 -0
- {forcingkit-0.15.0 → forcingkit-0.15.1}/src/forcingkit/ramps/currents_lis_dark.csv +0 -0
- {forcingkit-0.15.0 → forcingkit-0.15.1}/src/forcingkit/ramps/currents_lis_deep.csv +0 -0
- {forcingkit-0.15.0 → forcingkit-0.15.1}/src/forcingkit/ramps/currents_lis_haline.csv +0 -0
- {forcingkit-0.15.0 → forcingkit-0.15.1}/src/forcingkit/render.py +0 -0
- {forcingkit-0.15.0 → forcingkit-0.15.1}/src/forcingkit/settings.py +0 -0
- {forcingkit-0.15.0 → forcingkit-0.15.1}/src/forcingkit/zarr_stream.py +0 -0
- {forcingkit-0.15.0 → forcingkit-0.15.1}/static/app.js +0 -0
- {forcingkit-0.15.0 → forcingkit-0.15.1}/static/favicon.ico +0 -0
- {forcingkit-0.15.0 → forcingkit-0.15.1}/static/favicon.svg +0 -0
- {forcingkit-0.15.0 → forcingkit-0.15.1}/static/index.html +0 -0
- {forcingkit-0.15.0 → forcingkit-0.15.1}/static/logo.svg +0 -0
- {forcingkit-0.15.0 → forcingkit-0.15.1}/static/preview3d.js +0 -0
- {forcingkit-0.15.0 → forcingkit-0.15.1}/static/styles.css +0 -0
- {forcingkit-0.15.0 → forcingkit-0.15.1}/tests/__init__.py +0 -0
- {forcingkit-0.15.0 → forcingkit-0.15.1}/tests/integration/test_auth.py +0 -0
- {forcingkit-0.15.0 → forcingkit-0.15.1}/tests/integration/test_erddap_fetch.py +0 -0
- {forcingkit-0.15.0 → forcingkit-0.15.1}/tests/integration/test_mesh_frames_necofs.py +0 -0
- {forcingkit-0.15.0 → forcingkit-0.15.1}/tests/integration/test_necofs_volume_live.py +0 -0
- {forcingkit-0.15.0 → forcingkit-0.15.1}/tests/integration/test_nwps_nomads.py +0 -0
- {forcingkit-0.15.0 → forcingkit-0.15.1}/tests/integration/test_nyofs_obc_fetch.py +0 -0
- {forcingkit-0.15.0 → forcingkit-0.15.1}/tests/integration/test_obc_offshore_nj.py +0 -0
- {forcingkit-0.15.0 → forcingkit-0.15.1}/tests/integration/test_ofs_archive_paths.py +0 -0
- {forcingkit-0.15.0 → forcingkit-0.15.1}/tests/integration/test_s3_roms_fetchers.py +0 -0
- {forcingkit-0.15.0 → forcingkit-0.15.1}/tests/scripts/inspect_dem.py +0 -0
- {forcingkit-0.15.0 → forcingkit-0.15.1}/tests/scripts/inspect_grib.py +0 -0
- {forcingkit-0.15.0 → forcingkit-0.15.1}/tests/scripts/inspect_zarr.py +0 -0
- {forcingkit-0.15.0 → forcingkit-0.15.1}/tests/unit/test_coastwatch.py +0 -0
- {forcingkit-0.15.0 → forcingkit-0.15.1}/tests/unit/test_dbofs.py +0 -0
- {forcingkit-0.15.0 → forcingkit-0.15.1}/tests/unit/test_dispatcher.py +0 -0
- {forcingkit-0.15.0 → forcingkit-0.15.1}/tests/unit/test_erddap.py +0 -0
- {forcingkit-0.15.0 → forcingkit-0.15.1}/tests/unit/test_hrrr_atm.py +0 -0
- {forcingkit-0.15.0 → forcingkit-0.15.1}/tests/unit/test_hrrr_idx.py +0 -0
- {forcingkit-0.15.0 → forcingkit-0.15.1}/tests/unit/test_hrrr_levels.py +0 -0
- {forcingkit-0.15.0 → forcingkit-0.15.1}/tests/unit/test_hrrr_points.py +0 -0
- {forcingkit-0.15.0 → forcingkit-0.15.1}/tests/unit/test_hycom.py +0 -0
- {forcingkit-0.15.0 → forcingkit-0.15.1}/tests/unit/test_layered_mesh.py +0 -0
- {forcingkit-0.15.0 → forcingkit-0.15.1}/tests/unit/test_main.py +0 -0
- {forcingkit-0.15.0 → forcingkit-0.15.1}/tests/unit/test_mesh_frames.py +0 -0
- {forcingkit-0.15.0 → forcingkit-0.15.1}/tests/unit/test_ndbc.py +0 -0
- {forcingkit-0.15.0 → forcingkit-0.15.1}/tests/unit/test_necofs_hindcast.py +0 -0
- {forcingkit-0.15.0 → forcingkit-0.15.1}/tests/unit/test_necofs_mesh_cache.py +0 -0
- {forcingkit-0.15.0 → forcingkit-0.15.1}/tests/unit/test_necofs_parent.py +0 -0
- {forcingkit-0.15.0 → forcingkit-0.15.1}/tests/unit/test_necofs_volume.py +0 -0
- {forcingkit-0.15.0 → forcingkit-0.15.1}/tests/unit/test_noaa_currents.py +0 -0
- {forcingkit-0.15.0 → forcingkit-0.15.1}/tests/unit/test_noaa_datum.py +0 -0
- {forcingkit-0.15.0 → forcingkit-0.15.1}/tests/unit/test_nwps.py +0 -0
- {forcingkit-0.15.0 → forcingkit-0.15.1}/tests/unit/test_nyofs.py +0 -0
- {forcingkit-0.15.0 → forcingkit-0.15.1}/tests/unit/test_obc_donor_report.py +0 -0
- {forcingkit-0.15.0 → forcingkit-0.15.1}/tests/unit/test_obc_pipeline.py +0 -0
- {forcingkit-0.15.0 → forcingkit-0.15.1}/tests/unit/test_removed_routes.py +0 -0
- {forcingkit-0.15.0 → forcingkit-0.15.1}/tests/unit/test_settings.py +0 -0
- {forcingkit-0.15.0 → forcingkit-0.15.1}/tests/unit/test_usgs.py +0 -0
- {forcingkit-0.15.0 → forcingkit-0.15.1}/tests/unit/test_usgs_rivers.py +0 -0
- {forcingkit-0.15.0 → forcingkit-0.15.1}/tests/unit/test_zarr_stream.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: forcingkit
|
|
3
|
-
Version: 0.15.
|
|
3
|
+
Version: 0.15.1
|
|
4
4
|
Summary: Spatiotemporal forcing for computational Earth-system models: selects, regrids and serves model-ready time series with provenance.
|
|
5
5
|
Project-URL: Documentation, https://forcingkit.docs.lhzn.io
|
|
6
6
|
Project-URL: Issues, https://github.com/lhzn-io/forcingkit/issues
|
|
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "forcingkit"
|
|
7
|
-
version = "0.15.
|
|
7
|
+
version = "0.15.1"
|
|
8
8
|
description = "Spatiotemporal forcing for computational Earth-system models: selects, regrids and serves model-ready time series with provenance."
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.11"
|
|
@@ -104,6 +104,15 @@ class JobRegistry:
|
|
|
104
104
|
job = self.get(job_id)
|
|
105
105
|
return job is not None and job.status in ACTIVE
|
|
106
106
|
|
|
107
|
+
def forget(self, job_id: Optional[str] = None) -> None:
|
|
108
|
+
"""Drop the finished job under `job_id`, or every finished job, once its store has been
|
|
109
|
+
deleted. An active job is kept: its build is still writing the store."""
|
|
110
|
+
with self._lock:
|
|
111
|
+
for key in [job_id] if job_id is not None else list(self._jobs):
|
|
112
|
+
job = self._jobs.get(key)
|
|
113
|
+
if job is not None and job.status not in ACTIVE:
|
|
114
|
+
del self._jobs[key]
|
|
115
|
+
|
|
107
116
|
def _run(self, job: Job, build: Callable[[], Dict[str, Any]]) -> None:
|
|
108
117
|
job.status, job.started = "running", _now()
|
|
109
118
|
try:
|
|
@@ -217,6 +217,9 @@ async def purge_cache() -> Dict[str, str]:
|
|
|
217
217
|
try:
|
|
218
218
|
shutil.rmtree(cache_dir)
|
|
219
219
|
os.makedirs(cache_dir, exist_ok=True)
|
|
220
|
+
from forcingkit_serve.jobs import registry
|
|
221
|
+
|
|
222
|
+
registry.forget()
|
|
220
223
|
return {"status": "success", "message": "Cache purged successfully."}
|
|
221
224
|
except Exception as e:
|
|
222
225
|
logger.error(f"Failed to purge cache: {e}")
|
|
@@ -760,10 +763,13 @@ def _submit(
|
|
|
760
763
|
from forcingkit_serve.routers.stores import store_complete
|
|
761
764
|
|
|
762
765
|
kind = JOB_KINDS[zarr_id.split("_", 1)[0]]
|
|
763
|
-
|
|
766
|
+
complete = store_complete(zarr_path)
|
|
767
|
+
if not cache_bust and not registry.is_active(zarr_id) and complete:
|
|
764
768
|
job = registry.finished(zarr_id, kind, cached())
|
|
765
769
|
else:
|
|
766
|
-
job
|
|
770
|
+
# A succeeded job whose store is no longer complete (deleted from the cache since) is
|
|
771
|
+
# stale: rebuild rather than return it.
|
|
772
|
+
job = registry.submit(zarr_id, kind, build, rebuild=cache_bust or not complete)
|
|
767
773
|
return JSONResponse(status_code=202, content=_job_view(job, http))
|
|
768
774
|
|
|
769
775
|
|
|
@@ -827,6 +833,14 @@ def get_job(job_id: str, http: Request) -> Dict[str, Any]:
|
|
|
827
833
|
if not STORE_ID.match(job_id):
|
|
828
834
|
raise HTTPException(status_code=400, detail="invalid job id")
|
|
829
835
|
job = registry.get(job_id)
|
|
836
|
+
if (
|
|
837
|
+
job is not None
|
|
838
|
+
and job.result is not None
|
|
839
|
+
and not store_complete(job.result["zarr_path"])
|
|
840
|
+
):
|
|
841
|
+
# Its store was deleted after the build: the job no longer has a result to report.
|
|
842
|
+
registry.forget(job_id)
|
|
843
|
+
job = None
|
|
830
844
|
if job is None:
|
|
831
845
|
zarr_path = os.path.join(settings.cache_dir(), f"{job_id}.zarr")
|
|
832
846
|
if not store_complete(zarr_path):
|
|
@@ -470,6 +470,10 @@ async def delete_dataset(dataset_id: str):
|
|
|
470
470
|
old_sidecar = zarr_path.parent / f"{dataset_id}_metadata.json"
|
|
471
471
|
if old_sidecar.exists():
|
|
472
472
|
old_sidecar.unlink()
|
|
473
|
+
# A finished job for this store would otherwise still report it as built.
|
|
474
|
+
from forcingkit_serve.jobs import registry
|
|
475
|
+
|
|
476
|
+
registry.forget(dataset_id)
|
|
473
477
|
logger.info(f"Deleted Zarr dataset: {zarr_path}")
|
|
474
478
|
return {"status": "success", "message": f"Deleted {dataset_id}"}
|
|
475
479
|
|
|
@@ -137,6 +137,75 @@ def test_store_finished_before_restart_is_a_succeeded_job(client):
|
|
|
137
137
|
assert body["status"] == "succeeded" and body["result"]["id"] == zarr_id
|
|
138
138
|
|
|
139
139
|
|
|
140
|
+
def test_registry_rebuilds_succeeded_job_on_request_and_forgets_finished_ones():
|
|
141
|
+
registry = jobs.JobRegistry(workers=1)
|
|
142
|
+
release = threading.Event()
|
|
143
|
+
first = registry.submit("obc_0123456789ab", "ocean", lambda: {"n": 1})
|
|
144
|
+
deadline = time.monotonic() + 5
|
|
145
|
+
while first.status != "succeeded" and time.monotonic() < deadline:
|
|
146
|
+
time.sleep(0.01)
|
|
147
|
+
assert first.status == "succeeded"
|
|
148
|
+
assert registry.submit("obc_0123456789ab", "ocean", lambda: {"n": 2}) is first
|
|
149
|
+
|
|
150
|
+
def slow_build():
|
|
151
|
+
release.wait(5)
|
|
152
|
+
return {"n": 3}
|
|
153
|
+
|
|
154
|
+
rebuilt = registry.submit("obc_0123456789ab", "ocean", slow_build, rebuild=True)
|
|
155
|
+
assert rebuilt is not first
|
|
156
|
+
|
|
157
|
+
# An active job survives forget; a finished one does not.
|
|
158
|
+
registry.forget("obc_0123456789ab")
|
|
159
|
+
registry.forget()
|
|
160
|
+
assert registry.get("obc_0123456789ab") is rebuilt
|
|
161
|
+
release.set()
|
|
162
|
+
while rebuilt.status != "succeeded" and time.monotonic() < deadline:
|
|
163
|
+
time.sleep(0.01)
|
|
164
|
+
registry.forget("obc_0123456789ab")
|
|
165
|
+
assert registry.get("obc_0123456789ab") is None
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
def _built_obc_job(client, monkeypatch, calls):
|
|
169
|
+
def fake_dispatch(**kwargs):
|
|
170
|
+
calls.append(kwargs)
|
|
171
|
+
_write_store(kwargs["zarr_path"])
|
|
172
|
+
return kwargs["zarr_path"]
|
|
173
|
+
|
|
174
|
+
monkeypatch.setattr(dispatcher, "dispatch_obc_request", fake_dispatch)
|
|
175
|
+
body = client.post("/api/v1/jobs/obc", json=OBC).json()
|
|
176
|
+
assert _wait(client, body["status_url"])["status"] == "succeeded"
|
|
177
|
+
return body
|
|
178
|
+
|
|
179
|
+
|
|
180
|
+
def test_succeeded_job_whose_store_vanished_is_rebuilt(client, monkeypatch):
|
|
181
|
+
import shutil
|
|
182
|
+
|
|
183
|
+
calls = []
|
|
184
|
+
body = _built_obc_job(client, monkeypatch, calls)
|
|
185
|
+
_, zarr_path, _ = main._obc_store(main.OBCRequest(**OBC))
|
|
186
|
+
shutil.rmtree(zarr_path) # removed behind the service's back, registry untouched
|
|
187
|
+
|
|
188
|
+
assert client.get(body["status_url"]).status_code == 404
|
|
189
|
+
again = client.post("/api/v1/jobs/obc", json=OBC)
|
|
190
|
+
assert again.status_code == 202
|
|
191
|
+
done = _wait(client, again.json()["status_url"])
|
|
192
|
+
assert done["status"] == "succeeded" and len(calls) == 2
|
|
193
|
+
assert done["result"]["id"] == body["job_id"]
|
|
194
|
+
|
|
195
|
+
|
|
196
|
+
def test_deleting_a_store_drops_its_job(client, monkeypatch):
|
|
197
|
+
calls = []
|
|
198
|
+
body = _built_obc_job(client, monkeypatch, calls)
|
|
199
|
+
deleted = client.delete(f"/api/v1/cache/dataset/{body['job_id']}")
|
|
200
|
+
assert deleted.status_code == 200
|
|
201
|
+
assert jobs.registry.get(body["job_id"]) is None
|
|
202
|
+
|
|
203
|
+
again = client.post("/api/v1/jobs/obc", json=OBC)
|
|
204
|
+
assert again.status_code == 202
|
|
205
|
+
assert _wait(client, again.json()["status_url"])["status"] == "succeeded"
|
|
206
|
+
assert len(calls) == 2
|
|
207
|
+
|
|
208
|
+
|
|
140
209
|
def test_unknown_and_invalid_job_ids(client):
|
|
141
210
|
assert client.get("/api/v1/jobs/obc_000000000000").status_code == 404
|
|
142
211
|
assert client.get("/api/v1/jobs/not-a-store").status_code == 400
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|