fm-weck 1.4.8__py3-none-any.whl → 1.5.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- fm_weck/__init__.py +1 -1
- fm_weck/capture.py +31 -0
- fm_weck/cli.py +217 -22
- fm_weck/engine.py +144 -12
- fm_weck/exceptions.py +58 -0
- fm_weck/file_util.py +5 -0
- fm_weck/grpc_service/__init__.py +9 -0
- fm_weck/grpc_service/fm_weck_client.py +148 -0
- fm_weck/grpc_service/fm_weck_server.py +175 -0
- fm_weck/grpc_service/proto/__init__.py +0 -0
- fm_weck/grpc_service/proto/fm_weck_service.proto +139 -0
- fm_weck/grpc_service/proto/fm_weck_service_pb2.py +73 -0
- fm_weck/grpc_service/proto/fm_weck_service_pb2.pyi +151 -0
- fm_weck/grpc_service/proto/fm_weck_service_pb2_grpc.py +331 -0
- fm_weck/grpc_service/proto/generate_protocol_files.sh +18 -0
- fm_weck/grpc_service/request_handling.py +332 -0
- fm_weck/grpc_service/run_store.py +38 -0
- fm_weck/grpc_service/server_utils.py +27 -0
- fm_weck/image_mgr.py +3 -1
- fm_weck/resources/Containerfile +1 -2
- fm_weck/resources/__init__.py +26 -8
- fm_weck/resources/c_program_example.c +627 -0
- fm_weck/run_result.py +1 -1
- fm_weck/serve.py +21 -14
- fm_weck/smoke_test_mode.py +82 -0
- {fm_weck-1.4.8.dist-info → fm_weck-1.5.0.dist-info}/METADATA +3 -1
- {fm_weck-1.4.8.dist-info → fm_weck-1.5.0.dist-info}/RECORD +29 -14
- {fm_weck-1.4.8.dist-info → fm_weck-1.5.0.dist-info}/WHEEL +0 -0
- {fm_weck-1.4.8.dist-info → fm_weck-1.5.0.dist-info}/entry_points.txt +0 -0
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# This file is part of fm-weck: executing fm-tools in containerized environments.
|
|
2
|
+
# https://gitlab.com/sosy-lab/software/fm-weck
|
|
3
|
+
#
|
|
4
|
+
# SPDX-FileCopyrightText: 2024 Dirk Beyer <https://www.sosy-lab.org>
|
|
5
|
+
#
|
|
6
|
+
# SPDX-License-Identifier: Apache-2.0
|
|
7
|
+
|
|
8
|
+
import logging
|
|
9
|
+
from threading import Lock
|
|
10
|
+
|
|
11
|
+
from .request_handling import RunHandler
|
|
12
|
+
|
|
13
|
+
RUNS_IN_PROGRESS = {}
|
|
14
|
+
EXCEPTIONS = {}
|
|
15
|
+
LOCK = Lock()
|
|
16
|
+
logger = logging.getLogger(__name__)
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def add_run(run_handler: RunHandler) -> str:
|
|
20
|
+
with LOCK:
|
|
21
|
+
RUNS_IN_PROGRESS[run_handler.run_id] = run_handler
|
|
22
|
+
|
|
23
|
+
return run_handler.run_id
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
def remove_run(run_id: str) -> None:
|
|
27
|
+
with LOCK:
|
|
28
|
+
RUNS_IN_PROGRESS.pop(run_id, None)
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
def get_run(run_id: str) -> RunHandler:
|
|
32
|
+
with LOCK:
|
|
33
|
+
return RUNS_IN_PROGRESS.get(run_id)
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
def active_runs() -> frozenset:
|
|
37
|
+
with LOCK:
|
|
38
|
+
return frozenset(RUNS_IN_PROGRESS.keys())
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# This file is part of fm-weck: executing fm-tools in containerized environments.
|
|
2
|
+
# https://gitlab.com/sosy-lab/software/fm-weck
|
|
3
|
+
#
|
|
4
|
+
# SPDX-FileCopyrightText: 2024 Dirk Beyer <https://www.sosy-lab.org>
|
|
5
|
+
#
|
|
6
|
+
# SPDX-License-Identifier: Apache-2.0
|
|
7
|
+
|
|
8
|
+
import logging
|
|
9
|
+
import tempfile
|
|
10
|
+
from pathlib import Path
|
|
11
|
+
|
|
12
|
+
TMP_DIR = Path(tempfile.gettempdir()) / "fm_weck"
|
|
13
|
+
TMP_DIR.mkdir(parents=True, exist_ok=True)
|
|
14
|
+
logger = logging.getLogger(__name__)
|
|
15
|
+
logger.setLevel(logging.INFO)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def read_file(file_path: Path) -> bytes:
|
|
19
|
+
"""
|
|
20
|
+
Returns the content of a file as bytes.
|
|
21
|
+
|
|
22
|
+
:param file_path: The path to the file.
|
|
23
|
+
:return: The content of the file as bytes.
|
|
24
|
+
"""
|
|
25
|
+
|
|
26
|
+
with open(file_path, "rb") as file:
|
|
27
|
+
return file.read()
|
fm_weck/image_mgr.py
CHANGED
|
@@ -26,6 +26,8 @@ if TYPE_CHECKING:
|
|
|
26
26
|
|
|
27
27
|
CONTAINERFILE = Path(__file__).parent / "resources" / "Containerfile"
|
|
28
28
|
|
|
29
|
+
logger = logging.getLogger(__name__)
|
|
30
|
+
|
|
29
31
|
|
|
30
32
|
class ImageMgr(object):
|
|
31
33
|
"""
|
|
@@ -49,7 +51,7 @@ class ImageMgr(object):
|
|
|
49
51
|
if not image.base_images:
|
|
50
52
|
raise NoImageError("No base image specified")
|
|
51
53
|
|
|
52
|
-
|
|
54
|
+
logger.info(
|
|
53
55
|
"Building image from from base image %s with packages %s", image.base_images[0], image.required_packages
|
|
54
56
|
)
|
|
55
57
|
image_cmd = engine.image_from(CONTAINERFILE)
|
fm_weck/resources/Containerfile
CHANGED
fm_weck/resources/__init__.py
CHANGED
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
# SPDX-License-Identifier: Apache-2.0
|
|
7
7
|
|
|
8
8
|
import importlib.resources as pkg_resources
|
|
9
|
+
from functools import cache
|
|
9
10
|
from pathlib import Path
|
|
10
11
|
|
|
11
12
|
from . import fm_tools, properties
|
|
@@ -19,16 +20,33 @@ RUNEXEC_SCRIPT = "runexec"
|
|
|
19
20
|
|
|
20
21
|
|
|
21
22
|
def iter_fm_data():
|
|
22
|
-
for
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
23
|
+
for entry in pkg_resources.files(fm_tools).iterdir():
|
|
24
|
+
if entry.name.endswith((".yml", ".yaml")):
|
|
25
|
+
with pkg_resources.as_file(entry) as path:
|
|
26
|
+
fm_data_path = Path(path)
|
|
27
|
+
if fm_data_path.is_file():
|
|
28
|
+
yield fm_data_path
|
|
27
29
|
|
|
28
30
|
|
|
29
31
|
def iter_properties():
|
|
30
|
-
for
|
|
31
|
-
with pkg_resources.
|
|
32
|
-
prop_path = Path(
|
|
32
|
+
for entry in pkg_resources.files(properties).iterdir():
|
|
33
|
+
with pkg_resources.as_file(entry) as path:
|
|
34
|
+
prop_path = Path(path)
|
|
33
35
|
if prop_path.is_file():
|
|
34
36
|
yield prop_path
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
@cache
|
|
40
|
+
def fm_tools_choice_map():
|
|
41
|
+
ignore = {
|
|
42
|
+
"schema.yml",
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
actors = {actor_def.stem: actor_def for actor_def in iter_fm_data() if (actor_def.name not in ignore)}
|
|
46
|
+
|
|
47
|
+
return actors
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
@cache
|
|
51
|
+
def property_choice_map():
|
|
52
|
+
return {spec_path.stem: spec_path for spec_path in iter_properties() if spec_path.suffix != ".license"}
|