Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ jobs:
uses: docker/setup-buildx-action@v3
- name: Replace run integration test command
run: |
sed -i "s+mundialis/actinia:latest+mundialis/actinia:2.9.2_G83+g" docker/actinia-module-plugin-test/Dockerfile
sed -i "s+mundialis/actinia:latest+mundialis/actinia:grass8.3+g" docker/actinia-module-plugin-test/Dockerfile
- name: Tests of actinia-module-plugin
id: docker_build
uses: docker/build-push-action@v6
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ in any module, import `from actinia_module_plugin.resources.logging import log`


### Running tests
You can run the tests in the actinia-modules-plugin-test docker. For that you can comment the execution of the test in the docker/actinia-modules-plugin-test/Dockerfile `RUN ./tests_with_redis.sh` and run the following commands:
You can run the tests in the actinia-modules-plugin-test docker. For that you can comment the execution of the test in the docker/actinia-modules-plugin-test/Dockerfile `RUN ./tests_with_kvdb.sh` and run the following commands:
```bash
docker build -f docker/actinia-module-plugin-test/Dockerfile -t actinia-module-plugin-test .

Expand All @@ -39,5 +39,5 @@ docker run -it actinia-module-plugin-test -i
cd /src/actinia-module-plugin/

# run all tests
./tests_with_redis.sh
./tests_with_kvdb.sh
```
6 changes: 3 additions & 3 deletions docker/actinia-module-plugin-test/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ ENV TEMPLATE_VALUE_ENV_RASTER=elevation
ENV TEMPLATE_VALUE_ENV_TYPE=raster

# install things only for tests
RUN apk add --no-cache redis
RUN apk add --no-cache valkey valkey-cli
RUN pip install --upgrade setuptools && pip install pytest pytest-cov pwgen

ENTRYPOINT ["/bin/sh"]
Expand All @@ -35,7 +35,7 @@ COPY docker/actinia-module-plugin-test/actinia-module-plugin-test.cfg /etc/defau
COPY docker/actinia-module-plugin-test/actinia-module-plugin-test.cfg /etc/default/actinia-module-plugin-test
COPY . /src/actinia-module-plugin/

RUN chmod a+x tests_with_redis.sh
RUN chmod a+x tests_with_kvdb.sh
RUN pip install .

RUN ./tests_with_redis.sh
RUN ./tests_with_kvdb.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ force_https_urls = True
[QUEUE]
queue_type = local

[REDIS]
redis_server_url = localhost
redis_server_port = 6379
[KVDB]
kvdb_server_url = localhost
kvdb_server_port = 6379
worker_queue_name = actinia_job
worker_logfile = /actinia_core/workspace/tmp/actinia_worker_test.log

Expand Down
8 changes: 4 additions & 4 deletions src/actinia_module_plugin/api/modules/actinia.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@


actinia-module viewer
Templates can be stored file based and in redis
Templates can be stored file based and in kvdb

* List all actinia-modules
* Describe single actinia-module
Expand All @@ -40,7 +40,7 @@
createProcessChainTemplateListFromFileSystem,
)
from actinia_module_plugin.core.modules.actinia_user_templates import (
createProcessChainTemplateListFromRedis,
createProcessChainTemplateListFromKvdb,
)
from actinia_module_plugin.core.modules.actinia_common import (
createActiniaModule,
Expand All @@ -59,8 +59,8 @@ def get(self):
"""Get a list of all actinia modules (process chain templates)."""

pc_list_fs = createProcessChainTemplateListFromFileSystem()
pc_list_redis = createProcessChainTemplateListFromRedis()
pc_list = pc_list_fs + pc_list_redis
pc_list_kvdb = createProcessChainTemplateListFromKvdb()
pc_list = pc_list_fs + pc_list_kvdb

pc_list = filter(pc_list)

Expand Down
8 changes: 4 additions & 4 deletions src/actinia_module_plugin/api/modules/combined.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@


actinia-module + grass-module viewer
Templates can be stored file based and in redis
Templates can be stored file based and in kvdb

* List all GRASS GIS modules and actinia-modules
* Describe single module
Expand All @@ -39,7 +39,7 @@
createProcessChainTemplateListFromFileSystem,
)
from actinia_module_plugin.core.modules.actinia_user_templates import (
createProcessChainTemplateListFromRedis,
createProcessChainTemplateListFromKvdb,
)
from actinia_module_plugin.core.modules.actinia_common import (
createActiniaModule,
Expand Down Expand Up @@ -75,8 +75,8 @@ def get(self):
final_grass_list = createFullModuleList(self, final_grass_list)

pc_list_fs = createProcessChainTemplateListFromFileSystem()
pc_list_redis = createProcessChainTemplateListFromRedis()
module_list = final_grass_list + pc_list_fs + pc_list_redis
pc_list_kvdb = createProcessChainTemplateListFromKvdb()
module_list = final_grass_list + pc_list_fs + pc_list_kvdb

module_list = filter(module_list)

Expand Down
6 changes: 3 additions & 3 deletions src/actinia_module_plugin/api/modules/grass.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@
from actinia_module_plugin.core.modules.grass import createGrassModule
from actinia_module_plugin.core.modules.grass import createFullModuleList
from actinia_module_plugin.core.modules.grass import installGrassAddon
from actinia_module_plugin.core.modules.accessible_modules_redis_interface import (
addGrassAddonToModuleListRedis,
from actinia_module_plugin.core.modules.accessible_modules_kvdb_interface import (
addGrassAddonToModuleListKvdb,
)
from actinia_module_plugin.model.modules import ModuleList
from actinia_module_plugin.model.responseModels import (
Expand Down Expand Up @@ -104,7 +104,7 @@ def post(self, grassmodule):
response = installGrassAddon(self, grassmodule)

if response["status"] == "finished":
addGrassAddonToModuleListRedis(self, grassmodule)
addGrassAddonToModuleListKvdb(self, grassmodule)
msg = "Successfully installed GRASS addon " + grassmodule + "."
status_code = 201
else:
Expand Down
8 changes: 4 additions & 4 deletions src/actinia_module_plugin/api/processing.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@

from flask import jsonify, make_response
from flask_restful_swagger_2 import swagger
from actinia_core.core.common.redis_interface import enqueue_job
from actinia_core.core.common.kvdb_interface import enqueue_job
from actinia_core.models.response_models import create_response_from_model
from actinia_core.processing.common.ephemeral_processing_with_export import (
start_job as start_job_ephemeral_processing_with_export,
Expand All @@ -73,7 +73,7 @@
createProcessChainTemplateListFromFileSystem,
)
from actinia_module_plugin.core.modules.actinia_user_templates import (
createProcessChainTemplateListFromRedis,
createProcessChainTemplateListFromKvdb,
)
from actinia_module_plugin.core.modules.grass import createModuleList
from actinia_module_plugin.core.processing import fillTemplateFromProcessChain
Expand Down Expand Up @@ -105,7 +105,7 @@ def log_error_to_resource_logger(self, msg, rdc):
resource_id=self.resource_id,
iteration=1,
document=data,
expiration=rdc.config.REDIS_RESOURCE_EXPIRE_TIME,
expiration=rdc.config.KVDB_RESOURCE_EXPIRE_TIME,
)


Expand Down Expand Up @@ -167,7 +167,7 @@ def preprocess_build_pc_and_enqueue(self, preprocess_kwargs, start_job):
# get grass and actinia module lists
module_list = createModuleList(self)
pc_global_list = createProcessChainTemplateListFromFileSystem()
pc_user_list = createProcessChainTemplateListFromRedis()
pc_user_list = createProcessChainTemplateListFromKvdb()
grass_module_list = []
actinia_module_list = []

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,45 +16,45 @@
limitations under the License.


Accessible Modules Redis Interface
Accessible Modules Kvdb Interface
"""

__license__ = "Apache-2.0"
__author__ = "Anika Weinmann, Carmen Tawalika, Guido Riembauer, Julia Haas"
__copyright__ = "Copyright 2021 - 2022, mundialis GmbH & Co. KG"
__maintainer__ = "mundialis GmbH & Co. KG"

from actinia_core.core.redis_user import RedisUserInterface
from actinia_core.core.kvdb_user import KvdbUserInterface
from actinia_core.core.common.config import Configuration


def getAccessibleModuleListRedis(self):
redis_interface = RedisUserInterface()
def getAccessibleModuleListKvdb(self):
kvdb_interface = KvdbUserInterface()
conf = Configuration()
try:
conf.read()
except Exception:
pass

server = conf.REDIS_SERVER_URL
port = conf.REDIS_SERVER_PORT
if conf.REDIS_SERVER_PW:
redis_password = conf.REDIS_SERVER_PW
server = conf.KVDB_SERVER_URL
port = conf.KVDB_SERVER_PORT
if conf.KVDB_SERVER_PW:
kvdb_password = conf.KVDB_SERVER_PW
else:
redis_password = None
redis_interface.connect(host=server, port=port, password=redis_password)
kvdb_password = None
kvdb_interface.connect(host=server, port=port, password=kvdb_password)
user = self.user.get_id()
access_modules = redis_interface.get_credentials(user)["permissions"][
access_modules = kvdb_interface.get_credentials(user)["permissions"][
"accessible_modules"
]
redis_interface.disconnect()
kvdb_interface.disconnect()
return access_modules


def addGrassAddonToModuleListRedis(self, grassmodule):
def addGrassAddonToModuleListKvdb(self, grassmodule):
"""
This function adds installed GRASS addon to the user's module list
in redis.
in kvdb.
"""
self.user.add_accessible_modules(
[
Expand Down
4 changes: 2 additions & 2 deletions src/actinia_module_plugin/core/modules/actinia_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@


actinia-module viewer
Common module for file based and redis templates
Common module for file based and kvdb templates
"""

__license__ = "Apache-2.0"
Expand Down Expand Up @@ -207,7 +207,7 @@ def execute_interface_descr(self, vp):
pc_item = {
item_key: {"module": vp.module, "interface-description": True}
}
# TODO make use of module in redis cache if exists
# TODO make use of module in kvdb cache if exists
response = run_process_chain(self.resourceBaseSelf, pc_item)
xml_strings = response["process_log"]
self.count = self.count + 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
actinia-module viewer
Module for templates stored in redis which are user defined
Module for templates stored in kvdb which are user defined
"""

__license__ = "Apache-2.0"
Expand All @@ -31,7 +31,7 @@
from actinia_module_plugin.model.modules import Module


def createProcessChainTemplateListFromRedis():
def createProcessChainTemplateListFromKvdb():
"""
list all stored templates and return as actinia-module list
"""
Expand Down
42 changes: 21 additions & 21 deletions src/actinia_module_plugin/core/modules/grass.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@
from actinia_module_plugin.core.modules.parser import ParseInterfaceDescription
from actinia_module_plugin.model.modules import Module
from actinia_module_plugin.resources.logging import log
from actinia_module_plugin.core.modules.grass_modules_redis_interface import (
redis_grass_module_interface,
from actinia_module_plugin.core.modules.grass_modules_kvdb_interface import (
kvdb_grass_module_interface,
)
from actinia_module_plugin.core.modules.accessible_modules_redis_interface import (
getAccessibleModuleListRedis,
from actinia_module_plugin.core.modules.accessible_modules_kvdb_interface import (
getAccessibleModuleListKvdb,
)


Expand Down Expand Up @@ -114,7 +114,7 @@ def createModuleList(self):


def createModuleUserList(self):
return getAccessibleModuleListRedis(self)
return getAccessibleModuleListKvdb(self)


def build_and_run_iface_description_pc(self, module_list):
Expand Down Expand Up @@ -144,33 +144,33 @@ def build_and_run_iface_description_pc(self, module_list):


def connect():
"""This method initializes the connection with redis."""
"""This method initializes the connection with kvdb."""
conf = Configuration()
try:
conf.read()
except Exception:
pass

server = conf.REDIS_SERVER_URL
port = conf.REDIS_SERVER_PORT
if conf.REDIS_SERVER_PW:
redis_password = conf.REDIS_SERVER_PW
server = conf.KVDB_SERVER_URL
port = conf.KVDB_SERVER_PORT
if conf.KVDB_SERVER_PW:
kvdb_password = conf.KVDB_SERVER_PW
else:
redis_password = None
kvdb_password = None

redis_grass_module_interface.connect(
host=server, port=port, password=redis_password
kvdb_grass_module_interface.connect(
host=server, port=port, password=kvdb_password
)

return redis_grass_module_interface
return kvdb_grass_module_interface


def cacheGrassModule(grass_module):
"""
Insert grass_module into database
"""
redis_grass_module_interface = connect()
cached_module = redis_grass_module_interface.create(grass_module)
kvdb_grass_module_interface = connect()
cached_module = kvdb_grass_module_interface.create(grass_module)

return cached_module

Expand All @@ -186,9 +186,9 @@ def createGrassModule(self, module):
# This is currently the only mechanism to update a cached
# module via API call.
# If not, then cache it
redis_grass_module_interface = connect()
if redis_grass_module_interface.exists(module):
redis_grass_module_interface.update(module, grass_module)
kvdb_grass_module_interface = connect()
if kvdb_grass_module_interface.exists(module):
kvdb_grass_module_interface.update(module, grass_module)
else:
cacheGrassModule(grass_module)

Expand All @@ -201,8 +201,8 @@ def createFullModuleList(self, module_list):

# Check if modules are already cached, then use them
for module in module_list:
redis_grass_module_interface = connect()
grass_module = redis_grass_module_interface.read(module["id"])
kvdb_grass_module_interface = connect()
grass_module = kvdb_grass_module_interface.read(module["id"])
if grass_module:
detailed_module_list.append(grass_module)
else:
Expand Down
Loading