Skip to content

Processes

Georama publishes QGIS processing algorithms as OGC API - Processes - Part 1: Core. Georama does not run the algorithms itself. QGIS-Server-Light process workers run them, and Georama decides who may run which process with which layers, keeps track of the jobs and hands out their results.

flowchart LR
    client["Client<br/>browser, QGIS, script"]
    georama["Georama<br/>processes app"]
    redis[("Redis<br/>jobs:process")]
    worker["QSL process worker"]
    output[("process-output<br/>volume")]
    client -->|" execute, status, results "| georama
    georama -->|" job with the resolved layers "| redis
    redis --> worker
    worker -->|" state, progress, result "| redis
    worker -->|" files "| output
    output -->|" downloads "| georama

What Gets Published

Processes. Which algorithms are served is decided by the process workers, see the worker documentation of QGIS-Server-Light. A publisher picks among them under Publish processes from QGIS in the management pages of the processes app. A published process is listed as long as a process worker serves it. When the workers run different QGIS versions or describe a process differently, the management pages show a warning on it, so the deployment can be corrected.

Processes the workers mark as internal are served for Georama itself. They are never offered for publishing.

Process inputs. QGIS-Server-Light does not know which layers exist. A datasource is offered as layer to processes once it is published as process input, with the ProcessInput action on the datasource. An input of a process is offered the process inputs which fit it: the kind of layer (vector or raster) and, for vector layers, the geometry type.

Permissions. Both work like the other published objects of Georama. A public process can be executed by everybody, otherwise the execute permission on the process is needed. A public process input can be used by everybody, otherwise the use as process input permission is needed. A job belongs to the user who executed it, only they (and superusers) see it. A job executed anonymously belongs to nobody, it doesn't show up in any list and whoever knows its id sees it.

Endpoints

All paths are below http://localhost:4242/processes, the landing page. As in OGC API - Processes, no path ends with a slash, neither the landing page nor the management below manage.

Path What it is
(none) Landing page with the links to everything below
conformance The conformance classes Georama implements
processes The processes the user may execute
processes/<process id> The description of a process with its inputs and outputs
processes/<process id>/execution Executes the process (POST), the HTML page offers a form
jobs The jobs of the user
jobs/<job id> The status of a job, with its progress while it runs
jobs/<job id> (DELETE) Dismisses the job, see Dismissing a Job
jobs/<job id>/results The results of a successful job
jobs/<job id>/results/<output id> The file of one output, as download
schema The OpenAPI definition, see OpenAPI
schema/swagger, schema/redoc The documentation of the API, built from the definition

The process id is the id of the QGIS algorithm, e.g. processes/native:buffer.

Every endpoint answers as HTML or JSON. ?f=json or ?f=html decides, without it the Accept header does. f wins over Accept.

Executing

An execute request names the values of the inputs and, for file outputs, the format:

{
  "inputs": {"INPUT": "<process input id>", "DISTANCE": 10},
  "outputs": {"OUTPUT": {"format": {"mediaType": "application/geo+json"}}}
}
  • Synchronous (the default): Georama waits up to GEORAMA_PROCESSES_SYNC_EXECUTE_TIMEOUT seconds and answers with the results. A job which isn't finished by then is answered like an asynchronous one.
  • Asynchronous (header Prefer: respond-async): Georama answers right away with 201, the status of the job and its URL in Location. The client follows the status until the job is finished and then fetches the results.

A file output is answered as link to its download. Without a chosen format the first format the process offers is written.

Jobs and Their Files

A job and its files are kept for GEORAMA_PROCESSES_JOB_EXPIRE seconds after it was created. The georama-housekeeping service runs manage delete_expired_jobs every hour, which deletes the expired jobs together with their files.

The process workers write the files, Georama serves them. So Georama and the housekeeping need the directory the process workers write to, mounted at GEORAMA_PROCESSES_OUTPUT_DIR. In the compose stack it is the volume process-output. Where the workers write is described in the worker documentation of QGIS-Server-Light.

Dismissing a Job

A job is dismissed with DELETE jobs/<job id>, the HTML page of the job offers a button for it. A queued job never starts, a running job is stopped by its process worker, the results and files of a finished job are removed. The answer is the status of the job, which is dismissed from then on. Its results answer 404 with no-such-job, as for a job which never existed.

Whoever may look at a job may dismiss it: the user who executed it, superusers and, for a job of an anonymous execution, anybody who knows its id.

Limits

Making a process public opens the process workers to everybody. Georama refuses an execution when one of these limits is reached:

Setting What it limits Answer
GEORAMA_PROCESSES_ANONYMOUS_EXECUTE_RATE Executions of all anonymous clients together per time window, e.g. 60/hour (the default). Empty means no limit. 429 with Retry-After
GEORAMA_PROCESSES_USER_EXECUTE_RATE Executions of each user per time window, no limit by default. 429 with Retry-After
GEORAMA_PROCESSES_MAX_UNFINISHED_JOBS Jobs a user may have queued or running at the same time, 5 by default. All anonymous executions together count as one user. 429 with Retry-After
GEORAMA_PROCESSES_OUTPUT_MIN_FREE_SPACE Megabytes which have to be free in GEORAMA_PROCESSES_OUTPUT_DIR, 1024 by default. Below, no execution is accepted and Georama logs a warning. 503

The executions are counted in the cache of Django. Without a cache configured, every Georama process counts on its own, so with several processes the effective rate is a multiple of the setting.

The process workers limit each job on their own, configured on the qsl-process-worker service:

Variable What it limits
QSL_PROCESS_TIMEOUT Seconds a job may run before it is stopped, 3600 by default.
QSL_PROCESS_MAX_OUTPUT_SIZE Megabytes a job may write before it is stopped, 1024 by default.
QSL_PROCESS_MAX_FEATURES Features a vector layer input may have, 1000000 by default.
QSL_PROCESS_WORKER_ONCE 1 (the default): the worker starts fresh after every job, so no job sees what the one before left behind.

0 switches a limit off. A job stopped by a limit fails with the reason as message. How the workers watch their jobs is described in the worker documentation of QGIS-Server-Light.

Limits per client and attribution. Georama doesn't limit per IP address and doesn't record who executed an anonymous job, such a job has no issuer. Behind a proxy, all clients share the IP address of the proxy, and between the client and Georama there may be further layers (load balancers, gateways, CDNs) Georama knows nothing about. Limiting and tracking single clients is therefore the responsibility of the network infrastructure in front of Georama, which sees the real address of the client. It also settles the privacy questions of logging these addresses.

OpenAPI

schema/?f=json is the OpenAPI 3.0 definition of the processes API, linked from the landing page together with Swagger and Redoc. The processes are only known at runtime, so the definition is built for the user asking for it: each process the user may execute gets its own execution path with the inputs it accepts, and the id of the processes and process inputs offers the ones the user may access.