manta-node 0.5b0.dev87__py3-none-any.whl → 0.5b0.dev91__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.
- manta_node/task_manager.py +36 -6
- {manta_node-0.5b0.dev87.dist-info → manta_node-0.5b0.dev91.dist-info}/METADATA +1 -1
- {manta_node-0.5b0.dev87.dist-info → manta_node-0.5b0.dev91.dist-info}/RECORD +7 -7
- {manta_node-0.5b0.dev87.dist-info → manta_node-0.5b0.dev91.dist-info}/WHEEL +0 -0
- {manta_node-0.5b0.dev87.dist-info → manta_node-0.5b0.dev91.dist-info}/entry_points.txt +0 -0
- {manta_node-0.5b0.dev87.dist-info → manta_node-0.5b0.dev91.dist-info}/licenses/LICENSE +0 -0
- {manta_node-0.5b0.dev87.dist-info → manta_node-0.5b0.dev91.dist-info}/top_level.txt +0 -0
manta_node/task_manager.py
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import asyncio
|
|
2
|
+
import os
|
|
2
3
|
from collections import deque
|
|
3
4
|
from datetime import datetime
|
|
4
5
|
from pathlib import Path
|
|
5
6
|
from tempfile import TemporaryDirectory
|
|
6
|
-
from typing import List, Optional, Set, Tuple
|
|
7
|
+
from typing import Dict, List, Optional, Set, Tuple
|
|
7
8
|
|
|
8
9
|
from manta_common.build.common.system import EnvId, PairId
|
|
9
10
|
from manta_common.build.common.tasks import MqttTask, TaskStatus, TaskUpdate
|
|
@@ -21,7 +22,34 @@ from .infrastructure.container.manager import ContainerManager
|
|
|
21
22
|
from .infrastructure.grpc.client import NodeClient
|
|
22
23
|
from .tasks import TaskProgression, TaskProgressions
|
|
23
24
|
|
|
24
|
-
__all__ = ["TaskManager"]
|
|
25
|
+
__all__ = ["TaskManager", "build_image_env", "IMAGE_ENV_ALLOWLIST_VAR"]
|
|
26
|
+
|
|
27
|
+
# Name of the node-environment variable holding the comma-separated allowlist of
|
|
28
|
+
# env vars to forward into image-mode containers. Set via the manta-node systemd
|
|
29
|
+
# EnvironmentFile. Empty/unset => only the reserved keys are injected.
|
|
30
|
+
IMAGE_ENV_ALLOWLIST_VAR = "MANTA_IMAGE_ENV"
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
def build_image_env(reserved: Dict[str, str]) -> Dict[str, str]:
|
|
34
|
+
"""Build the environment for an image-mode container.
|
|
35
|
+
|
|
36
|
+
Forwards an allowlisted set of the node's own environment variables into the
|
|
37
|
+
container, merged under the caller's ``reserved`` keys — reserved keys win on
|
|
38
|
+
collision so a node env var can never spoof e.g. ``TASK_ID``.
|
|
39
|
+
|
|
40
|
+
The allowlist is a comma-separated list of variable names read from
|
|
41
|
+
``MANTA_IMAGE_ENV`` in the node's own environment (typically populated by the
|
|
42
|
+
manta-node systemd ``EnvironmentFile``). Names absent from the node
|
|
43
|
+
environment are skipped. When ``MANTA_IMAGE_ENV`` is unset or empty, only the
|
|
44
|
+
reserved keys are injected (prior behaviour).
|
|
45
|
+
"""
|
|
46
|
+
names = [
|
|
47
|
+
name.strip()
|
|
48
|
+
for name in os.environ.get(IMAGE_ENV_ALLOWLIST_VAR, "").split(",")
|
|
49
|
+
if name.strip()
|
|
50
|
+
]
|
|
51
|
+
forwarded = {name: os.environ[name] for name in names if name in os.environ}
|
|
52
|
+
return {**forwarded, **reserved}
|
|
25
53
|
|
|
26
54
|
|
|
27
55
|
class TaskManager(ContainerManager, ImageExecutor):
|
|
@@ -233,10 +261,12 @@ class TaskManager(ContainerManager, ImageExecutor):
|
|
|
233
261
|
swarm_id=swarm_id,
|
|
234
262
|
task_id=task_id,
|
|
235
263
|
image=task.image,
|
|
236
|
-
environment=
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
264
|
+
environment=build_image_env(
|
|
265
|
+
{
|
|
266
|
+
"TASK_ID": task_id.xid,
|
|
267
|
+
"SWARM_ID": swarm_id.xid,
|
|
268
|
+
}
|
|
269
|
+
),
|
|
240
270
|
)
|
|
241
271
|
self.image_task_ids.add((swarm_id.tid, task_id.tid))
|
|
242
272
|
else:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: manta_node
|
|
3
|
-
Version: 0.5b0.
|
|
3
|
+
Version: 0.5b0.dev91
|
|
4
4
|
Summary: Node side software of the Manta platform. It is responsible for the communication with the Manta Core and the execution of the tasks.
|
|
5
5
|
Author-email: Hugo Miralles <hugomiralles@manta-tech.io>, Matthew Thompson <matthew.thompson@manta-tech.io>
|
|
6
6
|
License: GNU AFFERO GENERAL PUBLIC LICENSE
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
manta_node/__init__.py,sha256=bgGWXH3yQVhNf0v1ZGUBAy5Y51fqb0Y-EaLnocbcino,153
|
|
2
2
|
manta_node/__main__.py,sha256=0VzbY1KfezaARZDuCBc7Th1GO_-BnKTK8eDEXhgP5J4,1731
|
|
3
3
|
manta_node/node_orchestrator.py,sha256=0VMBsZSMQiIe9L-Bd7Jn4avNpNyDCMa1kyPSTgRiOes,17336
|
|
4
|
-
manta_node/task_manager.py,sha256=
|
|
4
|
+
manta_node/task_manager.py,sha256=B_h6Mc7to8CTzLLgqrINgEALTYWX1Aek3Tio34ICXag,19887
|
|
5
5
|
manta_node/tasks.py,sha256=W__XjU17AX8VqOtgy8HRBmxWtVufTkFvri8s8Y3R394,6721
|
|
6
6
|
manta_node/utils.py,sha256=gkYRB7fylk1jy1sm7nKU7o8eadGxn0AX4IjCHT6Wzuw,1179
|
|
7
7
|
manta_node/cli/__init__.py,sha256=arzO3mXDJ-E2yeeytbZfN7mCswwxdQ43_QjyeL2E5yE,134
|
|
@@ -35,9 +35,9 @@ manta_node/infrastructure/metrics/collector.py,sha256=nhFPAbjA04ye3UaGN95_zdpf9h
|
|
|
35
35
|
manta_node/infrastructure/metrics/metrics_collector.py,sha256=jhEocAPWS6xgbNvcBBiEB9cAN_9hEGssZJXoysQzWOk,10518
|
|
36
36
|
manta_node/infrastructure/mqtt/__init__.py,sha256=riXo1sXgO4YV6DHCmWRqK61BAmuGLdHiVdQFunAJadA,140
|
|
37
37
|
manta_node/infrastructure/mqtt/command_handler.py,sha256=bDH8k3Vkbbb7q3P68VamhMbtLJ4vSSivqZP3IfMBqIQ,11833
|
|
38
|
-
manta_node-0.5b0.
|
|
39
|
-
manta_node-0.5b0.
|
|
40
|
-
manta_node-0.5b0.
|
|
41
|
-
manta_node-0.5b0.
|
|
42
|
-
manta_node-0.5b0.
|
|
43
|
-
manta_node-0.5b0.
|
|
38
|
+
manta_node-0.5b0.dev91.dist-info/licenses/LICENSE,sha256=P5HojupjKoAusNtHqWOvO-YFolwLFWQ7Uq0XVKK9nFQ,35291
|
|
39
|
+
manta_node-0.5b0.dev91.dist-info/METADATA,sha256=A0_n5jnU92mC1l6gTncaA5r-PGfkTC6W-rjDogDBXdA,44653
|
|
40
|
+
manta_node-0.5b0.dev91.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
|
|
41
|
+
manta_node-0.5b0.dev91.dist-info/entry_points.txt,sha256=C_zcw6mdmztNxVUZGLZ83UH5TwcSuqb2C-rB4e2CQoc,56
|
|
42
|
+
manta_node-0.5b0.dev91.dist-info/top_level.txt,sha256=nbT5J5WETuXM9UPoQckl29uUOq8wMYdRb9QDx5kAFeo,11
|
|
43
|
+
manta_node-0.5b0.dev91.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|