Refactor : Backend API to integrate zenml integrations #501
Open
kshitijrajsharma wants to merge 16 commits into
Open
Refactor : Backend API to integrate zenml integrations #501kshitijrajsharma wants to merge 16 commits into
kshitijrajsharma wants to merge 16 commits into
Conversation
BREAKING CHANGE:
added bearer from access token , even in dev
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do ?
Refactors backend ; backend becomes a thin coordination layer over ZenML (ML pipelines) and STAC (model + dataset metadata). ZenML replaces Celery and Redis; the monolithic
coreapp is split into per-domain apps. Auth is unified onAuthorization: Bearer <token>for both dev and Hanko.shared/integrations/zenml.py.ramp-workerandyolo-workerare archived; ZenML now owns pipeline execution.stac_idreferences.shared/integrations/stac.pyis the only client.accounts,datasets,modelregistry,trainings,predictions,feedback,notifications,stars,workspace,system. Cross-cutting code inshared/.django.tasks+django-tasks-db(Postgres-backed) replaces Redis as the task broker. Used for dataset build and status-sync re-enqueues.accounts/(renamed fromlogin/). Hanko viahotosm_auth_django(JWT + cookie). Dev via staticFAIR_DEV_TOKEN. Both readAuthorization: Bearer <token>. OpenAPI security scheme is HTTP Bearer.uv,uv-build,ruff,ty,commitizen,pre-commit.backend/justfileexposessetup / lint / test / run / migrate / worker.pydantic-settingsinconfig/env.py. Required values raise loud at boot. Secrets useSecretStr..env.examplemirrors the README tables.backend/Dockerfile. One top-leveldocker-compose.yml(postgres + api + worker).test_api.py,test_dataset_endpoints.py,test_training_endpoints.py,test_prediction_endpoints.py,test_zenml_wrapper.py). ZenML and STAC mocked. 120 passing.backend/ARCHITECTURE.md(flow + API reference + curl walkthrough). Rewrittenbackend/README.md.Breaking
Authorization: Bearer <token>. The legacyaccess-tokenheader is retired in favour of the unified Bearer scheme./api/v1/path layout is reorganised per app. Seebackend/ARCHITECTURE.md.SECRET_KEY,DATABASE_URL,FRONTEND_URL,API_BASE_URL,FAIR_ZENML_STORE_URL,FAIR_ZENML_STORE_API_KEY,FAIR_STAC_API_URL,BUCKET_NAME,AWS_*. Missing values raise at boot.celeryandrediscontainers are archived; background work runs underjust worker.docker-compose.dev.ymlanddocker-compose.prod.ymlare consolidated into a single rootdocker-compose.yml. Deployment topology lives ininfra/andfAIr-models/infra/.How to test
This branch is deployed at https://api.fair.krschap.tech/api/docs/
Every request uses
-H "Authorization: Bearer $TOKEN". Substitute IDs returned from each step into the next.Create AOI
Capture
properties.idasAOI_ID.Build dataset
Capture
idasDATASET_IDandstac_idasSTAC_ID.Poll dataset build
Repeat until
"published"(~2 min for this AOI). Confirms STAC item + presigned chips/labels URLs.Submit training
Capture
idasTR_IDandzenml_run_idasRUN_ID.Poll training, tail logs, cancel
Repeat the first call until
"completed"(~22 min).Publish local model
Capture
local_model_stac_idasLM_STAC_ID. Verify:Submit prediction
Capture
idasPRED_ID.Fetch prediction result
Returns three presigned URLs (
geojson,fgb,pmtiles). Open the geojson; expect ~150-200 building polygons.Public publish toggle
Swagger: open
http://127.0.0.1:8000/api/docs/, click Authorize, pasteFAIR_DEV_TOKENin the single Bearer field, runGET /api/v1/aois/. Expect 200.TODO