|
1 | | -================ |
2 | 1 | mapchete Hub CLI |
3 | 2 | ================ |
4 | 3 |
|
5 | | -CLI and Python bindings to mapchete Hub API. |
| 4 | +A command line interface for mapchete Hub. |
| 5 | + |
| 6 | +.. image:: https://img.shields.io/pypi/v/mapchete-hub-cli.svg |
| 7 | + :target: https://pypi.org/project/mapchete-hub-cli/ |
| 8 | + |
| 9 | +.. image:: https://img.shields.io/pypi/l/mapchete-hub-cli.svg |
| 10 | + :target: https://github.com/mapchete/mapchete-hub-cli/blob/main/LICENSE |
| 11 | + |
| 12 | +.. image:: https://img.shields.io/github/actions/workflow/status/mapchete/mapchete-hub-cli/python-package.yml?label=tests |
| 13 | + :target: https://github.com/mapchete/mapchete-hub-cli/actions |
| 14 | + |
| 15 | +.. image:: https://codecov.io/gh/mapchete/mapchete-hub-cli/graph/badge.svg?token=VD1YOF3QA2 |
| 16 | + :target: https://codecov.io/gh/mapchete/mapchete-hub-cli |
| 17 | + |
| 18 | +.. image:: https://img.shields.io/github/repo-size/mapchete/mapchete-hub-cli |
| 19 | + :target: https://github.com/mapchete/mapchete-hub-cli |
| 20 | + |
| 21 | +About mapchete Hub CLI |
| 22 | +======================== |
| 23 | + |
| 24 | +The mapchete Hub CLI provides a user-friendly command line interface (``mhub``) to interact with a running mapchete Hub instance. It simplifies the process of submitting, monitoring, and managing processing jobs without needing to write custom scripts or use tools like `curl`. |
| 25 | + |
| 26 | +This CLI is the recommended tool for users who want to script workflows or manage mapchete Hub jobs from their terminal. |
| 27 | + |
| 28 | + |
| 29 | +Key Features |
| 30 | +============ |
| 31 | + |
| 32 | +* **💻 Full Job Lifecycle Management**: Intuitive commands to ``execute``, ``job`` (status), ``jobs`` (list), ``cancel``, and ``retry`` processing jobs. |
| 33 | +* **⚙️ Inspection**: List available ``processes`` on a remote mapchete Hub and check remote package ``--remote-versions``. |
| 34 | +* **🔒 Authentication Support**: Handles basic authentication via command line options (``-u``, ``-p``) or environment variables. |
| 35 | +* **🤖 Script-Friendly**: Designed for easy integration into automated scripts and workflows. |
| 36 | + |
| 37 | + |
| 38 | +Installation |
| 39 | +============ |
| 40 | + |
| 41 | +Install the CLI and its dependencies from PyPI: |
| 42 | + |
| 43 | +.. code-block:: bash |
| 44 | +
|
| 45 | + pip install mapchete-hub-cli |
| 46 | +
|
| 47 | +
|
| 48 | +Quickstart |
| 49 | +========== |
| 50 | + |
| 51 | +**1. Point to your mapchete Hub** |
| 52 | + |
| 53 | +All commands require you to specify the mapchete Hub's URL using the ``-h`` or ``--host`` option. If the mapchete Hub is running on the same machine with default settings (``0.0.0.0:5000``), you may not need this option. |
| 54 | + |
| 55 | +**2. List Available Processes** |
| 56 | + |
| 57 | +You can see what processes are available on the target mapchete Hub instance: |
| 58 | + |
| 59 | +.. code-block:: bash |
| 60 | +
|
| 61 | + mhub -h 0.0.0.0:5000 processes |
6 | 62 |
|
7 | | -License |
8 | | -------- |
| 63 | +**3. Prepare a mapchete File** |
9 | 64 |
|
10 | | -MIT License |
| 65 | +Create a `mapchete process file <https://github.com/mapchete/mapchete>`_ using YAML syntax. **Note that all input and output paths must be absolute**, as they are resolved on the remote server. |
11 | 66 |
|
12 | | -Copyright (c) 2018 - 2024 `EOX IT Services`_ |
| 67 | +For example, `hillshade.mapchete`: |
| 68 | + |
| 69 | +.. code-block:: yaml |
| 70 | +
|
| 71 | + process: mapchete.processes.examples.hillshade |
| 72 | + zoom_levels: |
| 73 | + - 10 |
| 74 | + pyramid: |
| 75 | + grid: geodetic |
| 76 | + input: |
| 77 | + dem: https://data.example.com/path/to/dem.tif |
| 78 | + output: |
| 79 | + path: s3://my-bucket/path/to/hillshade_output |
| 80 | + format: GTiff |
| 81 | +
|
| 82 | +**4. Execute the Process** |
| 83 | + |
| 84 | +Use the ``execute`` command to send the job to the mapchete Hub. |
| 85 | + |
| 86 | +.. code-block:: bash |
| 87 | +
|
| 88 | + mhub -h 0.0.0.0:5000 execute hillshade.mapchete |
| 89 | +
|
| 90 | +The mapchete Hub will return a unique `job_id`: |
| 91 | + |
| 92 | +.. code-block:: text |
| 93 | +
|
| 94 | + 6227b68b-b7e6-4f40-a396-85763197f481 |
| 95 | +
|
| 96 | +**5. Check Job Status and Progress** |
| 97 | + |
| 98 | +Use the `job_id` with the ``job`` command to get a detailed status report, or ``progress`` for a quick look at the progress percentage. |
| 99 | + |
| 100 | +.. code-block:: bash |
| 101 | +
|
| 102 | + # Get detailed status |
| 103 | + mhub -h 0.0.0.0:5000 job 6227b68b-b7e6-4f40-a396-85763197f481 |
| 104 | +
|
| 105 | + # Get just the progress |
| 106 | + mhub -h 0.0.0.0:5000 progress 6227b68b-b7e6-4f40-a396-85763197f481 |
| 107 | +
|
| 108 | +**6. Manage Jobs** |
| 109 | + |
| 110 | +You can also list all jobs or cancel a running job: |
| 111 | + |
| 112 | +.. code-block:: bash |
| 113 | +
|
| 114 | + # List all jobs on the mapchete Hub |
| 115 | + mhub -h 0.0.0.0:5000 jobs |
| 116 | +
|
| 117 | + # Cancel a specific job |
| 118 | + mhub -h 0.0.0.0:5000 cancel 6227b68b-b7e6-4f40-a396-85763197f481 |
| 119 | +
|
| 120 | +
|
| 121 | +Contributing |
| 122 | +============ |
| 123 | + |
| 124 | +This 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. |
| 125 | + |
| 126 | +Acknowledgements |
| 127 | +================ |
13 | 128 |
|
14 | | -.. _`EOX IT Services`: https://eox.at/ |
| 129 | +The initial development of this project was made possible with the resources and support of `EOX IT Services GmbH <https://eox.at/>`_. |
0 commit comments