Skip to main content

An actinia-core plugin which adds example endpoints to actinia-core

Project description

actinia-cloudevent-plugin

This is a plugin for actinia-core which translates cloudevents into a process definition for actinia-core and runs as standalone app.

Installation and Setup

Use docker-compose for installation:

docker compose -f docker/docker-compose.yml build
docker compose -f docker/docker-compose.yml up -d

DEV setup with vscode

  1. Start actinia-core locally via local dev-setup as described in the actinia-docker repository
  2. Have this repository open locally with vscode and press F5. After a few seconds, a browser window should be openend, pointing to the version endpoint.

Alternatively, configure actinia-core to run jobs via actinia-worker. In the actinia-core dev-setup, use the per_job queue in actinia-docker/actinia-dev/actinia.cfg:

[QUEUE]
# queue_type = local

[QUEUE]
queue_type = per_job
kvdb_queue_server_url = valkey
kvdb_queue_server_password = pass
worker_queue_prefix = job_queue

And restart the vscode debugger. This way, a job is registered in the valkey DB, but not directly started.

Configuration

Requesting endpoint

Note: Assuming cloudevent-plugin is running as described in previous setup.

You can test the plugin and request the / endpoint, e.g. with:

JSON=tests/examples/cloudevent_example.json
curl -X POST -H 'Content-Type: application/json' --data @$JSON localhost:3003/

Or test with per_job queue

JSON=tests/examples/cloudevent_example.json
curl -X POST -H 'Content-Type: application/json' --data @$JSON localhost:3003/
# Get the actinia job queue name from the response
QUEUE_NAME=job_queue_resource_id-d4d9be86-5938-47ff-9c6d-7c79964862c0

docker run --rm --network actinia-docker_actinia-dev \
  -v $HOME/actinia/grassdb:/actinia_core/grassdb \
  -v $HOME/actinia/grassdb_user:/actinia_core/userdata \
  --entrypoint actinia-worker actiniacore -q $QUEUE_NAME

Exemplary returned cloudevent: tests/examples/cloudevent_example_return.json

Running tests

You can run the tests in the actinia test docker. These are the same steps which the github workflow is executing.

docker compose -f docker/docker-compose.yml up -d --build
sleep 10 && \
    docker logs docker-actinia-cloudevent-1 && echo && \
    docker logs docker-actinia-core-1 && echo && \
    docker logs docker-event-receiver-server-1
docker exec -t docker-actinia-cloudevent-1 make integrationtest
docker compose -f docker/docker-compose.yml down

Possible setup

graph

    1[Event Emitter, e.g. UI]
    2[Kafka Queue Broker]
    subgraph actinia
        direction TB
        3[actinia-cloudevent-plugin Transformer Service]
        %%3@{ shape: braces, label: "Transformer Service" }
        4[actinia worker JobSink]
        %%4@{ shape: braces, label: "JobSink" }
        5[actinia-core]
        %%5@{ shape: braces, label: " write job to valkey" }
        6[valkey]
    end

    1 -- Cloudevent --> 2
    2 <-- Cloudevent --> 3
    3 -- 1: func,RDC --> 5
    5 -- 2: func,RDC --> 6
    3 -- 3: Cloudevent (queue Name) per HTTP --> 4
    4 -- 4: func,RDC --> 6
    4 -- 5: webhook --> 3
    3 -- Cloudevent (status) --> 2

sequenceDiagram
    autonumber
    create participant event receiver
    create actor event sender
    create participant A as actinia-cloudevent-plugin<br/>Transformer Service
    %% Note right of A: Transformer Service #9829;
    event sender-->>A: Cloudevent
    create participant D as actinia-core
    A->>D: func,RDC
    create participant V as valkey
    D->>V: func,RDC
    D->>A: return <<QUEUE NAME>>
    create participant W as actinia worker<br/>JobSink
    A-XW: Cloudevent with <<QUEUE NAME>> per HTTP
    A-->>event receiver: new Cloudevent with <<QUEUE NAME>>
    destroy event sender
    A-->>event sender: return "Received event <<ID>><br>and returned event <<ID 2>><br> with actinia-job <<QUEUE NAME>>."
    rect rgb(191, 223, 255)
    W->>V: func,RDC
    par Processing
        loop process
            W->>W:
        end
    and Webhook
    opt Optional
        W->>A: status webhook (running)
        A-->>event receiver: Cloudevent (status)
    end
    end
    destroy W
    W->>A: status webhook (finished / error)
    A-->>event receiver: Cloudevent (status)
    end

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

actinia_cloudevent_plugin-1.0.1.tar.gz (26.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

actinia_cloudevent_plugin-1.0.1-py3-none-any.whl (29.6 kB view details)

Uploaded Python 3

File details

Details for the file actinia_cloudevent_plugin-1.0.1.tar.gz.

File metadata

File hashes

Hashes for actinia_cloudevent_plugin-1.0.1.tar.gz
Algorithm Hash digest
SHA256 69d698c85f9b5a8d449fc338e141cb912c8c4158a3f1aab004919ce69069d404
MD5 59af2c77d002668fa22466cb00973052
BLAKE2b-256 cff0c696c2271ef2360b2cbbfeeb9802a11752b09d8528b9bec1ed44c1ad9f72

See more details on using hashes here.

File details

Details for the file actinia_cloudevent_plugin-1.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for actinia_cloudevent_plugin-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 20186bb18cd8d3f416015149023639f9c599bb75769baef1fa430573a27fc72a
MD5 c335092924b5c5ea10f01ca8e330f33f
BLAKE2b-256 a5c7f0ba5266b5f70cef9caf63b0d19f7b8b730e5e12bc201ce57135ff8ebcc6

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page