diff --git a/.github/workflows/build-on-change-linux-bare.yaml b/.github/workflows/build-on-change-linux-bare.yaml index fbf512ba..1e7ccc2d 100644 --- a/.github/workflows/build-on-change-linux-bare.yaml +++ b/.github/workflows/build-on-change-linux-bare.yaml @@ -13,7 +13,7 @@ on: - test/** - .github/workflows/** - doc/** - - runtime/** + - qc_framework/** - docker/** # execute on every push made targeting the branches bellow @@ -28,7 +28,7 @@ on: - test/** - .github/workflows/** - doc/** - - runtime/** + - qc_framework/** - docker/** workflow_dispatch: # Allows manual triggering of the workflow @@ -111,33 +111,33 @@ jobs: name: unit-test-report-ubuntu path: ${{ github.workspace }}/build/Testing/Temporary/LastTest.log - - name: Runtime test execution + - name: Framework test execution run: | mv build out_build cp -r /home/$(whoami)/qc-build/bin bin cp out_build/examples/checker_bundle_example/DemoCheckerBundle bin/ - cd runtime + cd qc_framework curl -sSL https://install.python-poetry.org | python3 - poetry install --with dev poetry run pytest -rA > runtime_test.log - - name: Archive runtime test results + - name: Archive Framework test results uses: actions/upload-artifact@v4 with: - name: runtime-test-report-ubuntu - path: ${{ github.workspace }}/runtime/runtime_test.log + name: framework-test-report-ubuntu + path: ${{ github.workspace }}/qc_framework/runtime_test.log - name: Set up Python 3.10 uses: actions/setup-python@v4 with: python-version: '3.10' - - name: Execute checker bundles runtime + - name: Execute checker bundles run: | export ASAM_QC_FRAMEWORK_MANIFEST_DIR=${{ github.workspace }}/.github/workflows/linux-manifest export ASAM_QC_FRAMEWORK_INSTALLATION_DIR=/home/$(whoami)/qc-build/bin - pip install -e ${{ github.workspace }}/runtime + pip install -e ${{ github.workspace }}/qc_framework mkdir "/home/$(whoami)/odr_out" pip install asam-qc-opendrive@git+https://github.com/asam-ev/qc-opendrive@develop diff --git a/.github/workflows/build-on-change-linux-docker.yaml b/.github/workflows/build-on-change-linux-docker.yaml index f682c0a1..68d01898 100644 --- a/.github/workflows/build-on-change-linux-docker.yaml +++ b/.github/workflows/build-on-change-linux-docker.yaml @@ -13,7 +13,7 @@ on: - test/** - .github/workflows/** - doc/** - - runtime/** + - qc_framework/** - docker/** # execute on every push made targeting the branches bellow @@ -28,7 +28,7 @@ on: - test/** - .github/workflows/** - doc/** - - runtime/** + - qc_framework/** - docker/** jobs: @@ -41,7 +41,7 @@ jobs: - name: Docker Build run: | docker build -f docker/Dockerfile.linux --target unit_test -t unit_test . - docker build -f docker/Dockerfile.linux --target runtime_test -t runtime_test . + docker build -f docker/Dockerfile.linux --target framework_test -t framework_test . - name: Unit test execution if: github.event_name == 'pull_request' @@ -55,14 +55,14 @@ jobs: name: unit-test-report path: ${{ github.workspace }}/LastTest.log - - name: Runtime test execution + - name: Framework test execution if: github.event_name == 'pull_request' run: | - docker run -v ${{ github.workspace }}:/out --rm --name runtime_test runtime_test + docker run -v ${{ github.workspace }}:/out --rm --name framework_test framework_test - - name: Archive runtime test results + - name: Archive framework test results if: github.event_name == 'pull_request' && (success() || failure()) uses: actions/upload-artifact@v4 with: - name: runtime-test-report + name: framework-test-report path: ${{ github.workspace }}/runtime_test.log diff --git a/.github/workflows/build-on-change-windows.yaml b/.github/workflows/build-on-change-windows.yaml index f462ff72..cd66be15 100644 --- a/.github/workflows/build-on-change-windows.yaml +++ b/.github/workflows/build-on-change-windows.yaml @@ -13,7 +13,7 @@ on: - test/** - .github/workflows/** - doc/** - - runtime/** + - qc_framework/** - docker/** # execute on every push made targeting the branches bellow @@ -28,7 +28,7 @@ on: - test/** - .github/workflows/** - doc/** - - runtime/** + - qc_framework/** - docker/** workflow_dispatch: # Allows manual triggering of the workflow @@ -147,19 +147,19 @@ jobs: name: test-report path: ${{ github.workspace }}\build\Testing\Temporary\LastTest.log - - name: Runtime test execution + - name: Framework test execution run: | - Write-Output "Starting runtime tests..." + Write-Output "Starting framework tests..." Rename-Item -path "$env:WORKING_PATH\qc-framework\qc-framework\build" -NewName "$env:WORKING_PATH\qc-framework\qc-framework\out_build" Copy-Item -Path "$env:WORKING_PATH\QC-Framework-Out\bin" -Destination "$env:WORKING_PATH\qc-framework\qc-framework\bin" -Recurse Copy-Item -Path "$env:WORKING_PATH\qc-framework\qc-framework\out_build\examples\checker_bundle_example\Release\DemoCheckerBundle.exe" -Destination "$env:WORKING_PATH\qc-framework\qc-framework\bin" - cd "$env:WORKING_PATH\qc-framework\qc-framework\runtime" + cd "$env:WORKING_PATH\qc-framework\qc-framework\qc_framework" python3 -m pip install poetry python3 -m poetry install python3 -m poetry run pytest - Write-Output "All runtime tests done." + Write-Output "All framework tests done." shell: pwsh - name: Set up Python 3.10 @@ -167,14 +167,14 @@ jobs: with: python-version: '3.10' - - name: Execute checker bundles runtime + - name: Execute checker bundles run: | $env:ASAM_QC_FRAMEWORK_MANIFEST_DIR="$env:WORKING_PATH\qc-framework\qc-framework\.github\workflows\windows-manifest" $env:ASAM_QC_FRAMEWORK_INSTALLATION_DIR="$env:WORKING_PATH\QC-Framework-Out\bin" git config --system core.longpaths true - pip install -e $env:WORKING_PATH\qc-framework\qc-framework\runtime + pip install -e $env:WORKING_PATH\qc-framework\qc-framework\qc_framework mkdir "$env:WORKING_PATH\odr_out" pip install asam-qc-opendrive@git+https://github.com/asam-ev/qc-opendrive@develop diff --git a/INSTALL.md b/INSTALL.md index f15f3d54..4496bdfd 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -145,15 +145,15 @@ We recommend installing Python modules in a virtual environment. Virtual environ Using Virtualenv: ```bash -python3 -m venv runtime-venv -source runtime-venv/bin/activate +python3 -m venv .venv +source .venv/bin/activate ``` Using Conda: ```bash -conda create -y -n runtime-venv python=3.10 -conda activate runtime-venv +conda create -y -n .venv python=3.10 +conda activate .venv ``` ## Install Python Modules @@ -161,13 +161,13 @@ conda activate runtime-venv Python modules can be installed using `pip`. ```bash -pip install asam-qc-runtime@git+https://github.com/asam-ev/qc-framework@develop#subdirectory=runtime +pip install asam-qc-framework@git+https://github.com/asam-ev/qc-framework@develop#subdirectory=qc_framework ``` -**Note:** The above command will install `asam-qc-runtime` from the `develop` branch. If you want to install `asam-qc-runtime` from another branch or tag, replace `@develop` with the desired branch or tag. It is also possible to install from a local directory. +**Note:** The above command will install `asam-qc-framework` from the `develop` branch. If you want to install `asam-qc-framework` from another branch or tag, replace `@develop` with the desired branch or tag. It is also possible to install from a local directory. ```bash -pip install /home/user/qc-framework/runtime +pip install /home/user/qc-framework/qc_framework ``` ## Install ASAM Checker Bundles diff --git a/doc/manual/demo_pipeline.md b/doc/manual/demo_pipeline.md index 3008241e..66aec641 100644 --- a/doc/manual/demo_pipeline.md +++ b/doc/manual/demo_pipeline.md @@ -125,7 +125,7 @@ docker run \ The docker image will automatically: - Detect the type of file passed as input. - Create the specific config according to [config schema](../doc/schema/config_format.xsd). -- Execute the runtime with specific checker, result pooling and text result application. +- Execute the framework with specific checker, result pooling and text result application. Currently the demo_pipeline will install and execute: diff --git a/doc/manual/file_formats.md b/doc/manual/file_formats.md index 163a498e..28b8989e 100644 --- a/doc/manual/file_formats.md +++ b/doc/manual/file_formats.md @@ -10,7 +10,7 @@ with this file, You can obtain one at https://mozilla.org/MPL/2.0/. ## Configuration File (`*.xml`) -The runtime configuration settings are stored in a configuration file. This +The framework configuration settings are stored in a configuration file. This file defines which Checker Bundles and what checkers are used, how they are parameterized and whether the issues are warnings or errors. If a CheckerBundle outputs errors that are not configured in this file, the result pooling removes @@ -63,7 +63,7 @@ The name `Result.xqar` is reserved for the output of the Result Pooling module. * The name `Result.xqar` **MUST NOT** be used as the name of the result `.xqar` file for any Checker Bundle. * The file `Result.xqar` can be used as the input file for Report Modules. * The result file of each checker bundle must have the postfix `.xqar`. It must be a file name (e.g., `my-bundle-result.xqar`) and must not contain any path (both asolute path and relative path are not allowed). -* All the result files and the automatically generated `Result.xqar` will be stored in the in the output folder `qc-output-YYYY-MM-DD-HH-MM-SS-*`. It is also possible to configure the output folder path. For more details see the [Runtime Module documentation](runtime_module.md). +* All the result files and the automatically generated `Result.xqar` will be stored in the in the output folder `qc-output-YYYY-MM-DD-HH-MM-SS-*`. It is also possible to configure the output folder path. For more details see the [Framework Module documentation](python_qc_framework.md). ## Result File (`*.xqar`) diff --git a/doc/manual/manifest_file.md b/doc/manual/manifest_file.md index 7a293592..e9d6fa6c 100644 --- a/doc/manual/manifest_file.md +++ b/doc/manual/manifest_file.md @@ -11,8 +11,8 @@ There are two types of manifest files in the framework: **Framework manifest fil ## Framework Manifest File A framework manifest file is a JSON file containing a list of module manifest file paths. -The [runtime module](runtime_module.md) uses the framework manifest file to discover -and execute Checker Bundles and Report Modules. +The [framework executable](python_framework_module.md) uses manifest files to discover +and execute Checker Bundles, Result Poolers and Report Modules. The framework manifest file must follow the JSON format as in the example below. @@ -164,7 +164,7 @@ On Linux, environment variables of the form `$name` and `${name}` are supported. To register a Checker Bundle or Report Module with the framework: * First, a module manifest file must be provided. * Second, the path to the module manifest file must be included in the framework manifest file. -* Last, the framework manifest file can be provided to the [runtime module](runtime_module.md) when triggering a framework execution. +* Last, the framework manifest file can be provided to the [framework executable](python_qc_framework.md): ```bash qc_runtime --config=$PATH_TO_CONFIG_FILE --manifest=$PATH_TO_MANIFEST_FILE ``` diff --git a/doc/manual/runtime_module.md b/doc/manual/python_qc_framework.md similarity index 63% rename from doc/manual/runtime_module.md rename to doc/manual/python_qc_framework.md index 5c1c4f62..5b8a110e 100644 --- a/doc/manual/runtime_module.md +++ b/doc/manual/python_qc_framework.md @@ -1,6 +1,7 @@ -# Runtime module +# Framework module -The runtime module is responsible of executing the qc-framework modules specified in an input configuration file. +The Framework module is responsible for the execution of checker bundles, result poolers and result reporters, based +upon a defined configuration file. The main executable is implemented in the `runtime` submodule. Input configuration file need to respect the [config xsd schema](../doc/schema/config_format.xsd) @@ -13,16 +14,17 @@ The runtime module execute the following steps: ## Installation & Usage -The runtime module can be installed using pip. +The ASAM QC Framework can be installed using pip. ```bash -pip install asam-qc-runtime@git+https://github.com/asam-ev/qc-framework@develop#subdirectory=runtime +pip install asam-qc-framework@git+https://github.com/asam-ev/qc-framework@develop#subdirectory=qc_framework ``` -**Note:** The above command will install `asam-qc-runtime` from the `develop` branch. If you want to install `asam-qc-runtime` from another branch or tag, replace `@develop` with the desired branch or tag. It is also possible to install from a local directory. +**Note:** The above command will install `asam-qc-framework` from the `develop` branch. If you want to install `asam-qc-framework` from another branch or tag, replace `@develop` with the desired branch or tag. It is also possible to install from a local directory. ```bash -pip install /home/user/qc-framework/runtime +# From reporsitory root +pip install ./qc_framework ``` Then, it can be executed as follows. diff --git a/doc/manual/using_the_framework.md b/doc/manual/using_the_framework.md index a414e5e7..ac70be09 100644 --- a/doc/manual/using_the_framework.md +++ b/doc/manual/using_the_framework.md @@ -16,13 +16,13 @@ Example configuration files for running the official Checker Bundles for ASAM Op ## Run the Checker Bundles -The Checker Bundles can be run using the [runtime module](runtime_module.md). +The Checker Bundles are run by the [quality checker framework](python_qc_framework.md). ```bash qc_runtime --config "PATH_TO_CONFIG_FILE" --manifest "PATH_TO_MANIFEST_FILE" ``` -The output of the runtime modules are the `.xqar` [result files](file_formats.md) and any other output files from the specified report modules in the configuration file, such as `.txt` files for the text report module. If the ReportGUI is specified, the Report GUI will open. +The output of the framework are the `.xqar` [result files](file_formats.md) and any other output files from the specified report modules in the configuration file, such as `.txt` files for the text report module. If the ReportGUI is specified, the Report GUI will open. ## Reporting diff --git a/docker/Dockerfile.linux b/docker/Dockerfile.linux index d432e95b..6b9a72b5 100644 --- a/docker/Dockerfile.linux +++ b/docker/Dockerfile.linux @@ -36,7 +36,7 @@ COPY doc /app/framework/doc COPY CMakeLists.txt /app/framework/CMakeLists.txt COPY version /app/framework/version COPY licenses /app/framework/licenses -COPY runtime /app/framework/runtime +COPY qc_framework /app/framework/qc_framework COPY demo_pipeline /app/demo_pipeline RUN echo "Building framework..." && \ @@ -51,14 +51,14 @@ RUN echo "Building framework..." && \ echo "Done." RUN python3 -m pip install --no-cache-dir -r /app/demo_pipeline/requirements.txt && \ - python3 -m pip install --no-cache-dir /app/framework/runtime && \ + python3 -m pip install --no-cache-dir /app/framework/qc_framework && \ python3 -m pip install asam-qc-opendrive@git+https://github.com/asam-ev/qc-opendrive@develop && \ python3 -m pip install asam-qc-openscenarioxml@git+https://github.com/asam-ev/qc-openscenarioxml@develop && \ python3 -m pip install asam-qc-otx@git+https://github.com/asam-ev/qc-otx@develop -# Runtime test stage -FROM ubuntu:22.04 as runtime_test +# Framework test stage +FROM ubuntu:22.04 as framework_test # Dependancies installation currently required by ResultPooling and TextReport modules RUN echo "Installing Qt..." && \ @@ -74,13 +74,13 @@ RUN mkdir -p /app # For testing files COPY --from=framework_builder /app/framework /app/framework -# Copy install directory in runtime image +# Copy install directory in framework image COPY --from=framework_builder /home/root/qc-build/bin /app/framework/bin COPY --from=framework_builder /app/framework/build/test /app/framework/test # @NOTE this is just because DemoCheckerBundle is not installed by default COPY --from=framework_builder /app/framework/build/examples/checker_bundle_example/DemoCheckerBundle /app/framework/bin/ -WORKDIR /app/framework/runtime/ +WORKDIR /app/framework/qc_framework/ SHELL ["/bin/bash", "-c"] @@ -89,9 +89,9 @@ COPY --from=framework_builder /usr/local/bin /usr/local/bin RUN python3 -m pip install poetry==1.8.3 RUN poetry install --with dev -CMD poetry run pytest -rA > runtime_test.log && cp /app/framework/runtime/runtime_test.log /out/runtime_test.log +CMD poetry run pytest -rA > runtime_test.log && cp /app/framework/qc_framework/runtime_test.log /out/runtime_test.log -# Runtime stage +# Unit Test stage FROM framework_builder as unit_test CMD ctest --test-dir /app/framework/build -C Release && cp /app/framework/build/Testing/Temporary/LastTest.log /out/ @@ -113,7 +113,7 @@ RUN mkdir -p /app # Framework components COPY --from=framework_builder /home/root/qc-build/bin /app/framework/bin COPY --from=framework_builder /app/demo_pipeline /app/demo_pipeline -COPY --from=framework_builder /app/framework/runtime /app/framework/runtime +COPY --from=framework_builder /app/framework/qc_framework /app/framework/qc_framework # Framework schemas COPY --from=framework_builder /app/framework/doc/schema /app/framework/doc/schema diff --git a/docker/test_runtime.sh b/docker/test_runtime.sh index d16de66c..236f7870 100755 --- a/docker/test_runtime.sh +++ b/docker/test_runtime.sh @@ -10,8 +10,8 @@ cd .. DOCKER_BUILDKIT=1 \ docker build \ -f docker/Dockerfile.linux \ - --target runtime_test \ - -t runtime_test . + --target framework_test \ + -t framework_test . DOCKER_BUILDKIT=1 \ docker build \ @@ -21,7 +21,7 @@ DOCKER_BUILDKIT=1 \ docker run \ -v "$OUTPUT_DIR":/out \ - --rm --name runtime_test runtime_test + --rm --name framework_test framework_test docker run --rm \ -v "$OUTPUT_DIR":/out \ diff --git a/runtime/poetry.lock b/qc_framework/poetry.lock similarity index 100% rename from runtime/poetry.lock rename to qc_framework/poetry.lock diff --git a/runtime/pyproject.toml b/qc_framework/pyproject.toml similarity index 66% rename from runtime/pyproject.toml rename to qc_framework/pyproject.toml index 73f2d9d5..980938e1 100644 --- a/runtime/pyproject.toml +++ b/qc_framework/pyproject.toml @@ -1,12 +1,12 @@ [tool.poetry] -name = "asam-qc-runtime" +name = "asam-qc-framework" version = "0.1.0" -description = "Python runtime module responsible of executing the qc-framework modules specified in an input configuration file." +description = "Python ASAM Quality Checker Framework module. Executes bundles and creates result reports." authors = ["Danilo Romano ","Patrick Abrahão ","Tung Dinh "] license = "MPL-2.0" -readme = "../doc/manual/runtime_module.md" +readme = "../doc/manual/python_qc_framework.md" packages = [ - { include = "runtime" }, + { include = "qc_framework" }, ] [tool.poetry.dependencies] @@ -19,7 +19,7 @@ pytest = "^8.2.1" black = "^24.4.2" [tool.poetry.scripts] -qc_runtime = 'runtime.runtime:main' +qc_runtime = 'qc_framework.runtime:main' [build-system] requires = ["poetry-core"] diff --git a/qc_framework/qc_framework/__init__.py b/qc_framework/qc_framework/__init__.py new file mode 100644 index 00000000..093437a3 --- /dev/null +++ b/qc_framework/qc_framework/__init__.py @@ -0,0 +1,4 @@ +# Copyright 2024, ASAM e.V. +# This Source Code Form is subject to the terms of the Mozilla +# Public License, v. 2.0. If a copy of the MPL was not distributed +# with this file, You can obtain one at https://mozilla.org/MPL/2.0/. diff --git a/qc_framework/qc_framework/__main__.py b/qc_framework/qc_framework/__main__.py new file mode 100644 index 00000000..7e9ac126 --- /dev/null +++ b/qc_framework/qc_framework/__main__.py @@ -0,0 +1,9 @@ +# Copyright 2024, ASAM e.V. +# This Source Code Form is subject to the terms of the Mozilla +# Public License, v. 2.0. If a copy of the MPL was not distributed +# with this file, You can obtain one at https://mozilla.org/MPL/2.0/. + +if __name__ == "__main__": + from .runtime import main as qc_runtime + + qc_runtime() diff --git a/qc_framework/qc_framework/runtime/__init__.py b/qc_framework/qc_framework/runtime/__init__.py new file mode 100644 index 00000000..56bb8a9d --- /dev/null +++ b/qc_framework/qc_framework/runtime/__init__.py @@ -0,0 +1,5 @@ +# Copyright 2024, ASAM e.V. +# This Source Code Form is subject to the terms of the Mozilla +# Public License, v. 2.0. If a copy of the MPL was not distributed +# with this file, You can obtain one at https://mozilla.org/MPL/2.0/. +from .runtime import main diff --git a/runtime/runtime/models.py b/qc_framework/qc_framework/runtime/models.py similarity index 74% rename from runtime/runtime/models.py rename to qc_framework/qc_framework/runtime/models.py index f6a4af36..844e0cd6 100644 --- a/runtime/runtime/models.py +++ b/qc_framework/qc_framework/runtime/models.py @@ -1,3 +1,7 @@ +# Copyright 2024, ASAM e.V. +# This Source Code Form is subject to the terms of the Mozilla +# Public License, v. 2.0. If a copy of the MPL was not distributed +# with this file, You can obtain one at https://mozilla.org/MPL/2.0/. import os import enum @@ -20,7 +24,7 @@ class FrameworkManifest(BaseModel): @field_validator("manifest_file_path") @classmethod - def file_path_must_exist(cls, v: List[str]) -> str: + def file_path_must_exist(cls, v: List[str]) -> List[str]: for raw_file_path in v: resolved_file_path = os.path.expandvars(raw_file_path) if not os.path.isfile(resolved_file_path): diff --git a/runtime/runtime/runtime.py b/qc_framework/qc_framework/runtime/runtime.py similarity index 70% rename from runtime/runtime/runtime.py rename to qc_framework/qc_framework/runtime/runtime.py index 447cdc9f..e9ae5b5e 100644 --- a/runtime/runtime/runtime.py +++ b/qc_framework/qc_framework/runtime/runtime.py @@ -2,17 +2,20 @@ # This Source Code Form is subject to the terms of the Mozilla # Public License, v. 2.0. If a copy of the MPL was not distributed # with this file, You can obtain one at https://mozilla.org/MPL/2.0/. +from __future__ import annotations -import argparse +from argparse import ArgumentParser import datetime import os import subprocess -from typing import Dict +from typing import TYPE_CHECKING, Dict from qc_baselib import Configuration +from .models import FrameworkManifest, ModuleManifest, ModuleType -from runtime import models +if TYPE_CHECKING: + from .models import Module FRAMEWORK_WORKING_DIR_VAR_NAME = "ASAM_QC_FRAMEWORK_WORKING_DIR" @@ -20,20 +23,22 @@ def run_module_command( - module: models.Module, config_file_path: str, output_path: str + module: "Module", config_file_path: str, working_dir: str ) -> None: - """Execute command specified in module configured with information in the + r""" + Execute command specified in module configured with information in the provided configuration. Args: - module (models.Module): module to be executed - config (Configuration): xml configuration containing information for execution. + module: module to be executed + config_file_path: defines the configuration file path + working_dir: defines the working directory """ try: print(f"Executing command: {os.path.expandvars(module.exec_command)}") cmd_env = os.environ.copy() - cmd_env[FRAMEWORK_WORKING_DIR_VAR_NAME] = output_path + cmd_env[FRAMEWORK_WORKING_DIR_VAR_NAME] = working_dir cmd_env[FRAMEWORK_CONFIG_PATH_VAR_NAME] = config_file_path process = subprocess.run( @@ -60,11 +65,23 @@ def run_module_command( def execute_modules( config_file_path: str, - available_checker_bundles: Dict[str, models.Module], - available_result_pooling: models.Module, - available_report_modules: Dict[str, models.Module], - output_path: str, + available_checker_bundles: Dict[str, "Module"], + available_result_pooling: "Module", + available_report_modules: Dict[str, "Module"], + working_dir: str, ) -> None: + r""" + Execute the full sequence of operations, checker bundles, result + pooling and result reporters as required as defined by the configuration file. + Each module needs to be declared via manifest file. + + Args: + config_file_path: path of the current configuration file + available_checker_bundles: available bundle modules as declared in manifests + available_result_pooling: result pooler module + available_report_modules: available report modules as declared in manifests + working_dir: working directory to be used for current execution + """ config = Configuration() config.load_from_file(config_file_path) @@ -93,29 +110,30 @@ def execute_modules( print(f"Executing checker bundles") for checker_bundle in checker_bundles: print(f"Executing checker module: {checker_bundle.name}") - run_module_command(checker_bundle, config_file_path, output_path) + run_module_command(checker_bundle, config_file_path, working_dir) # Result pooling print(f"Executing result pooling: {available_result_pooling.name}") - run_module_command(available_result_pooling, config_file_path, output_path) + run_module_command(available_result_pooling, config_file_path, working_dir) # Report modules print(f"Executing report modules") for report_module in report_modules: print(f"Executing report module: {report_module.name}") - run_module_command(report_module, config_file_path, output_path) + run_module_command(report_module, config_file_path, working_dir) def execute_runtime( config_file_path: str, manifest_file_path: str, working_dir: str ) -> None: - """Execute all runtime operations defined in the input manifest over the + r""" + Execute all runtime operations defined in the input manifest over the defined configuration. Args: - config_file_path (str): input configuration xml file path - manifest_file_path (str): input manifest json file path - working_dir (str): working directory + config_file_path: input configuration xml file path + manifest_file_path: input manifest json file path + working_dir: working directory """ checker_bundles = {} @@ -124,7 +142,7 @@ def execute_runtime( with open(manifest_file_path, "rb") as framework_manifest_file: json_data = framework_manifest_file.read().decode() - framework_manifest = models.FrameworkManifest.model_validate_json(json_data) + framework_manifest = FrameworkManifest.model_validate_json(json_data) for raw_module_manifest_path in framework_manifest.manifest_file_path: resolved_module_manifest_path = os.path.expandvars(raw_module_manifest_path) @@ -132,22 +150,22 @@ def execute_runtime( with open(resolved_module_manifest_path, "rb") as module_manifest_file: json_data = module_manifest_file.read().decode() - module_manifest = models.ModuleManifest.model_validate_json(json_data) + module_manifest = ModuleManifest.model_validate_json(json_data) for module in module_manifest.module: - if module.module_type == models.ModuleType.CHECKER_BUNDLE: + if module.module_type == ModuleType.CHECKER_BUNDLE: if module.name in checker_bundles: raise RuntimeError( f"{module.name} is used by multiple checker bundles on framework manifest." ) checker_bundles[module.name] = module - elif module.module_type == models.ModuleType.REPORT_MODULE: + elif module.module_type == ModuleType.REPORT_MODULE: if module.name in report_modules: raise RuntimeError( f"{module.name} is used by multiple report modules on framework manifest." ) report_modules[module.name] = module - elif module.module_type == models.ModuleType.RESULT_POOLING: + elif module.module_type == ModuleType.RESULT_POOLING: if result_pooling is not None: raise RuntimeError( "Multiple result pooling modules defined on framework manifest. There must be exactly one result pooling module defined." @@ -172,8 +190,15 @@ def execute_runtime( ) -def main(): - parser = argparse.ArgumentParser(description="Process XML configuration file.") +def main() -> None: + r""" + Runtime command line application + """ + parser = ArgumentParser( + prog="qc_runtime", + description="Executes checker bundles for quality checking via configuration file", + epilog="Quality Framework, Copyright 2024, ASAM e.V.: License MPLv2", + ) parser.add_argument( "--config", type=str, diff --git a/qc_framework/tests/__init__.py b/qc_framework/tests/__init__.py new file mode 100644 index 00000000..093437a3 --- /dev/null +++ b/qc_framework/tests/__init__.py @@ -0,0 +1,4 @@ +# Copyright 2024, ASAM e.V. +# This Source Code Form is subject to the terms of the Mozilla +# Public License, v. 2.0. If a copy of the MPL was not distributed +# with this file, You can obtain one at https://mozilla.org/MPL/2.0/. diff --git a/runtime/tests/test_data/3step_config.xml b/qc_framework/tests/test_data/3step_config.xml similarity index 100% rename from runtime/tests/test_data/3step_config.xml rename to qc_framework/tests/test_data/3step_config.xml diff --git a/runtime/tests/test_data/linux/demo_checker_bundle_manifest.json b/qc_framework/tests/test_data/linux/demo_checker_bundle_manifest.json similarity index 100% rename from runtime/tests/test_data/linux/demo_checker_bundle_manifest.json rename to qc_framework/tests/test_data/linux/demo_checker_bundle_manifest.json diff --git a/runtime/tests/test_data/linux/framework_manifest.json b/qc_framework/tests/test_data/linux/framework_manifest.json similarity index 100% rename from runtime/tests/test_data/linux/framework_manifest.json rename to qc_framework/tests/test_data/linux/framework_manifest.json diff --git a/runtime/tests/test_data/linux/result_pooling_manifest.json b/qc_framework/tests/test_data/linux/result_pooling_manifest.json similarity index 100% rename from runtime/tests/test_data/linux/result_pooling_manifest.json rename to qc_framework/tests/test_data/linux/result_pooling_manifest.json diff --git a/runtime/tests/test_data/linux/text_report_manifest.json b/qc_framework/tests/test_data/linux/text_report_manifest.json similarity index 100% rename from runtime/tests/test_data/linux/text_report_manifest.json rename to qc_framework/tests/test_data/linux/text_report_manifest.json diff --git a/runtime/tests/test_data/windows/demo_checker_bundle_manifest.json b/qc_framework/tests/test_data/windows/demo_checker_bundle_manifest.json similarity index 100% rename from runtime/tests/test_data/windows/demo_checker_bundle_manifest.json rename to qc_framework/tests/test_data/windows/demo_checker_bundle_manifest.json diff --git a/runtime/tests/test_data/windows/framework_manifest.json b/qc_framework/tests/test_data/windows/framework_manifest.json similarity index 100% rename from runtime/tests/test_data/windows/framework_manifest.json rename to qc_framework/tests/test_data/windows/framework_manifest.json diff --git a/runtime/tests/test_data/windows/result_pooling_manifest.json b/qc_framework/tests/test_data/windows/result_pooling_manifest.json similarity index 100% rename from runtime/tests/test_data/windows/result_pooling_manifest.json rename to qc_framework/tests/test_data/windows/result_pooling_manifest.json diff --git a/runtime/tests/test_data/windows/text_report_manifest.json b/qc_framework/tests/test_data/windows/text_report_manifest.json similarity index 100% rename from runtime/tests/test_data/windows/text_report_manifest.json rename to qc_framework/tests/test_data/windows/text_report_manifest.json diff --git a/runtime/tests/test_runtime.py b/qc_framework/tests/test_runtime.py similarity index 98% rename from runtime/tests/test_runtime.py rename to qc_framework/tests/test_runtime.py index 5b867a65..8f08eee0 100644 --- a/runtime/tests/test_runtime.py +++ b/qc_framework/tests/test_runtime.py @@ -8,7 +8,7 @@ import sys -import runtime.runtime as runtime +import qc_framework.runtime as runtime def on_windows() -> bool: diff --git a/runtime/runtime/__init__.py b/runtime/runtime/__init__.py deleted file mode 100644 index 253f5724..00000000 --- a/runtime/runtime/__init__.py +++ /dev/null @@ -1 +0,0 @@ -from . import models as models diff --git a/runtime/tests/__init__.py b/runtime/tests/__init__.py deleted file mode 100644 index e69de29b..00000000