Metadata-Version: 2.4
Name: mapchete-hub
Version: 2025.8.0
Summary: distributed mapchete processing
Project-URL: Homepage, https://github.com/mapchete/mapchete-hub
Author-email: Joachim Ungar <joachim.ungar@eox.at>, Petr Sevcik <petr.sevcik@eox.at>
License-Expression: MIT
License-File: LICENSE
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Scientific/Engineering :: GIS
Requires-Dist: click<=8.1.3
Requires-Dist: dask
Requires-Dist: dask-gateway
Requires-Dist: distributed
Requires-Dist: fastapi
Requires-Dist: httpx
Requires-Dist: mapchete[contours,http,s3,vrt]>=2024.2.1
Requires-Dist: mongomock
Requires-Dist: pydantic-settings
Requires-Dist: pydantic>=2.0.0
Requires-Dist: pymongo
Requires-Dist: uvicorn
Requires-Dist: zarr
Provides-Extra: complete
Requires-Dist: bokeh; extra == 'complete'
Requires-Dist: click<=8.1.3; extra == 'complete'
Requires-Dist: dask; extra == 'complete'
Requires-Dist: dask-gateway; extra == 'complete'
Requires-Dist: distributed; extra == 'complete'
Requires-Dist: fastapi; extra == 'complete'
Requires-Dist: kubernetes; extra == 'complete'
Requires-Dist: mapchete[contours,http,s3,vrt]>=2024.2.1; extra == 'complete'
Requires-Dist: mongomock; extra == 'complete'
Requires-Dist: numcodecs; extra == 'complete'
Requires-Dist: pydantic-settings; extra == 'complete'
Requires-Dist: pydantic>=2.0.0; extra == 'complete'
Requires-Dist: pymongo; extra == 'complete'
Requires-Dist: slack-sdk; extra == 'complete'
Requires-Dist: uvicorn; extra == 'complete'
Requires-Dist: zarr; extra == 'complete'
Provides-Extra: kubernetes
Requires-Dist: kubernetes; extra == 'kubernetes'
Provides-Extra: slack
Requires-Dist: slack-sdk; extra == 'slack'
Provides-Extra: test
Requires-Dist: httpx; extra == 'test'
Requires-Dist: pytest; extra == 'test'
Requires-Dist: pytest-cov; extra == 'test'
Requires-Dist: pytest-env; extra == 'test'
Requires-Dist: pytest-mongodb; extra == 'test'
Requires-Dist: requests; extra == 'test'
Provides-Extra: xarray
Requires-Dist: xarray; extra == 'xarray'
Requires-Dist: zarr; extra == 'xarray'
Description-Content-Type: text/x-rst

.. image:: logo/mapchete_hub_grey.svg

Distributed mapchete processing.

.. image:: https://img.shields.io/pypi/v/mapchete-hub.svg
  :target: https://pypi.org/project/mapchete-hub/

.. image:: https://img.shields.io/pypi/l/mapchete-hub.svg
  :target: https://github.com/mapchete/mapchete-hub/blob/main/LICENSE

.. image:: https://img.shields.io/github/actions/workflow/status/mapchete/mapchete-hub/python-package.yml?label=tests
  :target: https://github.com/mapchete/mapchete-hub/actions

.. image:: https://codecov.io/gh/mapchete/mapchete-hub/graph/badge.svg?token=VD1YOF3QA2
  :target: https://codecov.io/gh/mapchete/mapchete-hub

.. image:: https://img.shields.io/github/repo-size/mapchete/mapchete-hub
  :target: https://github.com/mapchete/mapchete-hub

mapchete Hub provides a RESTful web interface to the mapchete geospatial data processing engine. Its API is inspired by the **OGC API - Processes** standard and allows you to execute, manage, and scale your processing jobs over HTTP.

The main use cases for the Hub are running processing jobs asynchronously and scaling them up in the background, potentially using Dask for distributed computing.


Key Features
============

* 🌐 **OGC API - Processes inspired**: A REST API for submitting jobs, monitoring their status, and retrieving results.
* ⚙️ **Advanced Job Monitoring**: Inspect detailed job states (``pending``, ``running``, ``failed``, ``success``) and view the overall progress percentage for currently running jobs.
* 🚀 **Scalable Execution**: Can be configured to use Dask for distributed, parallel execution of jobs.
* 💬 **Slack Notifications**: Optionally sends job status updates directly to a configured Slack channel.
* 🐳 **Container-Ready**: Designed to be deployed in containerized environments like Docker, making it easy to scale your processing capabilities.


How It Works
============

1.  **Serve**: Start the mapchete Hub server. It listens for incoming job requests.
2.  **Prepare Job**: A client application prepares a job configuration as a JSON object that follows the `MapcheteJob schema <https://github.com/mapchete/mapchete-hub/blob/main/mapchete_hub/models.py#L29>`_.
3.  **Submit**: The client ``POST``\s the JSON configuration to the ``/jobs`` endpoint. The Hub validates it and returns a unique ``job_id``.
4.  **Monitor**: The client uses the ``job_id`` to poll the ``/jobs/{job_id}`` endpoint to track the job's status and progress.
5.  **Retrieve**: Once the job is successful, the results can be accessed from the location defined in the job's output configuration.


Getting Started
===============

Installation
------------

Install mapchete Hub and its dependencies from PyPI:

.. code-block:: bash

   pip install mapchete-hub

Running the Server
------------------

To start the server, simply run the following command:

.. code-block:: bash

   mhub-server start

The API documentation will be available at ``http://127.0.0.1:8000/docs``.

Interacting with the Hub
------------------------

While you can use tools like `curl`, the easiest way to interact with the Hub is by using the `mapchete-hub-cli <https://github.com/mapchete/mapchete-hub-cli>`_ package.

First, install the client:
.. code-block:: bash

   pip install mapchete-hub-cli

Next, create a job configuration file, for example `my_job.json`:

.. code-block:: json

   {
     "process": "mapchete.processes.examples.hillshade",
     "zoom_levels": [
       10
     ],
     "pyramid": {
       "grid": "geodetic"
     },
     "input": {
       "dem": "https://storage.googleapis.com/mapchete-test-data/cleantopo2/dem.tif"
     },
     "output": {
       "path": "./hillshade_output",
       "format": "GTiff",
       "dtype": "uint8",
       "bands": 1
     }
   }

Now, use the CLI to submit the job and check its status:

.. code-block:: bash

   # Submit the job
   mhub-cli submit my_job.json

   # The command will return a job_id. Use it to check the status:
   mhub-cli status <your_job_id>


Contributing
============

mapchete Hub is an open-source project and we welcome contributions! Please see the `Contributing Guide <https://github.com/mapchete/mapchete/blob/main/CONTRIBUTING.md>`_ in the main ``mapchete`` repository for guidelines on how to get started.

Acknowledgements
================

The initial development of mapchete Hub was made possible with the resources and support of `EOX IT Services GmbH <https://eox.at/>`_.