Skip to content

Add project as input#14

Merged
mmacata merged 3 commits intomainfrom
project-as-input
Feb 18, 2026
Merged

Add project as input#14
mmacata merged 3 commits intomainfrom
project-as-input

Conversation

@mmacata
Copy link
Member

@mmacata mmacata commented Feb 17, 2026

This PR changes how the GRASS GIS project in which to run the process can be defined.
We do not stick to the convention introduced in actinia-org/actinia-module-plugin#64 (project name must be set in template). Instead a default project is configured which can be overwritten as input at process execution. This input is also added to each process description.

Example for process description

{
  "categories": [
    "actinia-module",
    "global-template"
  ],
  "description": "Imports point and polygon and checks if point is in polygon.",
  "id": "point_in_polygon",
  "parameters": [
    {
      "description": "The input source that may be a landsat scene name, a sentinel2 scene name, a postGIS database string, or an URL that points to an accessible raster or vector file [generated from import_descr_source]",
      "name": "url_to_geojson_point",
      "optional": true,
      "schema": {
        "type": "string"
      }
    },
    {
      "description": "Name of GRASS GIS project to use",
      "name": "project",
      "optional": false,
      "schema": {
        "type": "string"
      },
      "default": "nc_spm_08"
    }
  ],
  "projects": [
    "nc_spm_08"
  ],
  "returns": []
}

Processing Examples

Project given as input

{
  "inputs": {
    "url_to_geojson_point": "https://raw.githubusercontent.com/mmacata/pagestest/gh-pages/pointInBonn.geojson",
    "project": "nc_spm_08"
  },
  "outputs": {
    "result": {
      "transmissionMode": "reference"
    }
  },
  "response": "document"
}

Will lead to HTTP POST to "http://actinia-core:8088/api/v3/projects/nc_spm_08/processing_export"

Non exiting project given as input

If the project does not exist, it will return

{
    "processID": "resource_id-7d04d408-c98e-4c7a-becf-3d4392e01d05",
    "type": "process",
    "jobID": "7d04d408-c98e-4c7a-becf-3d4392e01d05",
    "status": "failed",
    "message": "GrassInitError:  Error while executing the grass module.              The following error message was logged:\nERROR: MAPSET PERMANENT not found at /actinia_core/workspace/temp_db/gisdbase_083533fc70cb4cb5b4a2d4ad2697a069/nc_spm_088\n",
    "created": "2026-02-17T14:20:33+00:00",
    "finished": "2026-02-17T14:20:51+00:00",
    "updated": "2026-02-17T14:20:51+00:00",
    "progress": 0,
    "links": [
    {
        "href": "http://localhost:4044/jobs/7d04d408-c98e-4c7a-becf-3d4392e01d05",
        "rel": "self"
    }
    ]
}

No project given as input, default is used

If no project is given, the default project will be used (configurable).

Copy link
Member

@linakrisztian linakrisztian left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, thanks.
Maybe just think about reasonable tests for new project parameter?

@mmacata
Copy link
Member Author

mmacata commented Feb 18, 2026

I added one test - the different usage of project per config or per input parameter is not directly visible, but now the file src/actinia_ogc_api_processes_plugin/core/process_execution.py has a coverage of 100% and the content of if condition is also tested:

     if postbody.get("inputs").get("project"):
        project_name = postbody.get("inputs").get("project")

@mmacata mmacata merged commit b7da0a6 into main Feb 18, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants