Skip to content

Geoprocessing job lifecycle

Native application path: gRPC for live data and edits; PMTiles, GeoParquet and COG through the CDN. Start there for browser gRPC-Web setup, signed private URLs and regeneration after changes. OGC API and GeoServices REST examples below are compatibility workflows.

Server contract first

HonuaGeoprocessing and AsyncHonuaGeoprocessing operate registered OGC API Processes exposed by Honua Server. They do not upload or execute arbitrary Python code and expose no execution-backend selector.

Item Contract
Capability process.ogc-api-processes
Discover / Describe GET /ogc/processes/processes and GET /ogc/processes/processes/{processId}
Submit POST /ogc/processes/processes/{processId}/execution (optional Idempotency-Key header, max 512 chars)
Status GET /ogc/processes/jobs/{jobId}
Results GET /ogc/processes/jobs/{jobId}/results
Cancel DELETE /ogc/processes/jobs/{jobId} (200 OK confirmed terminal dismissed; 202 Accepted requested non-terminal; 409 Conflict terminal/unsupported)
Auth HonuaClient / AsyncHonuaClient API key, bearer token, or refreshable auth provider
Result href Same-origin absolute and relative links use the bound client. Off-origin links are refused unless explicitly allowlisted via with_approved_artifact_origins(...); allowlisted signed downloads never forward Honua credentials and refuse redirects.
Spilled streams honua-feature-stream: URIs stay server-side; pass them into downstream processes via LayerReference.from_result(...) or ArtifactReference.from_results(...).

Typed handles and vector chaining

Construct catalog-layer inputs, selections, CRS handles, result references, and governed destinations with the typed models in honua_sdk.geoprocessing:

  • LayerReference.from_catalog_layer(layer_id, selection=..., output_crs=...) targets a catalog layer with LayerSelection (where, object_ids, bbox or geometry/geometry_type/in_sr/spatial_rel, time/time_relation, out_fields) and CrsReference (outSrid).
  • LayerReference.from_result(results, crs=...) and ArtifactReference.from_results(results) extract inline data: URIs, spilled honua-feature-stream: references, or inline GeoJSON outputs so one process's output feeds straight into the next (Buffer -> Clip -> Dissolve).
  • LayerDestination(layer=..., target_srid=..., load_mode=...) targets governed persistence via sink.honua-layer (submit_persist_layer / persist_layer) and decodes its durable CommittedSinkReceipt.

Sync and async examples

For a single registered process, run the focused lifecycle script:

python examples/geoprocessing_job_lifecycle.py \
  --process-id geometry.buffer \
  --inputs-json '{"inputGeoJson":"{}","distance":100}'

For the full vector chain (discover/describe processes, authenticated submit with Idempotency-Key, bounded poll and reconnect by job_id, analytics.buffer-aggregate -> overlay.clip -> analytics.buffer-aggregate-managed, governed persistence via sink.honua-layer, and Source query read-back), run examples/geoprocessing_vector_chain.py in sync or async mode:

python examples/geoprocessing_vector_chain.py \
  --source-layer-id 1 \
  --clip-aoi-json '{"type":"FeatureCollection","features":[]}' \
  --destination-layer buffered_output \
  --reopen-service-id buffered_output

python examples/geoprocessing_vector_chain.py \
  --async-mode \
  --source-layer-id 1 \
  --clip-aoi-json '{"type":"FeatureCollection","features":[]}' \
  --destination-layer buffered_output \
  --reopen-service-id buffered_output

These commands belong to the example scripts. The product honua CLI currently has no process submission subcommands (honua gp inspect and honua gp logs read job diagnostics only).

Truthful retries, timeouts, cancellation, and receipts

  • No silent duplicate submission: HonuaClient does not auto-retry POST requests after ambiguous transport errors. Supply an explicit SubmissionOptions(idempotency_key=...) when submitting so a caller-driven replay after a lost response converges on the original durable job ID; a reused key with modified inputs surfaces 409 Conflict with its TerminalFailureReceipt.
  • Client timeout vs server state: wait_for_job(job, WaitOptions(timeout=..., dismiss_on_timeout=False)) raises GeoprocessingTimeoutError (a subclass of both HonuaError and TimeoutError) carrying recoverable exc.job_id and exc.job without cancelling the job, allowing callers to reconnect via gp.job(exc.job_id) and resume polling. wait(...) retains best-effort dismissal on timeout and records any DismissOutcome on exc.dismiss_outcome.
  • Requested vs confirmed cancellation: dismiss_job(job_id) returns a DismissOutcome that reports state="requested" on HTTP 202 Accepted (or non-terminal status) and state="confirmed" only when the server confirms terminal dismissed status on HTTP 200 OK. Continue polling gp.job(job_id) until a terminal state is confirmed.
  • Committed writes: When cancellation races after a sink commit, the server preserves status="successful" and emits a CommittedSinkReceipt (committed=True, features_written, batch_id) rather than claiming a rollback.
  • Machine-readable error receipts: HTTP failures (401, 403, 404, 409, 410, 413, 503) preserve HonuaHttpError.receipt (TerminalFailureReceipt), and GeoprocessingJobError exposes job_id, status, and any structured receipt.

Synchronous execution

respond_async=False lets the server return document outputs in the submission response. The SDK marks that execution successful and stores its qualified outputs in job.inline_results. Pass the job object to results() so the same code also works when the server chooses asynchronous execution:

job = gp.submit_inputs("geometry.area", inputs, respond_async=False)
terminal = gp.wait(job, timeout=120)
outputs = gp.results(terminal)

The async client uses the same contract with await. A synchronous response may have no durable job ID; retain the job object to retrieve its inline results.

Scope boundary: native GP vs honua-gp vs custom code

  • Native GP (honua-sdk): HonuaGeoprocessing / AsyncHonuaGeoprocessing target Honua Server's canonical OGC API Processes surface directly with typed handles, result interop (geopandas, raster), and truthful lifecycle control.
  • Desktop GIS compatibility layer (honua-gp): honua-gp is a separate Apache-2.0 compatibility distribution for teams migrating legacy desktop GIS Python scripts; do not conflate its tool-emulation matrix with the native honua-sdk OGC Processes contract.
  • Unsupported custom-code authoring: Operator-authored custom Python GP execution is AWS-Batch-only server-side (ADR-0063). The Python SDK provides no custom-code authoring or submission API and no execution-backend selector. Do not substitute submit_inputs() or submit_request() for that surface.