isar 1.16.15__py3-none-any.whl → 1.16.16__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.
Potentially problematic release.
This version of isar might be problematic. Click here for more details.
- isar/storage/blob_storage.py +12 -4
- isar/storage/storage_interface.py +3 -2
- isar/storage/uploader.py +4 -4
- isar/storage/utilities.py +2 -1
- {isar-1.16.15.dist-info → isar-1.16.16.dist-info}/METADATA +1 -1
- {isar-1.16.15.dist-info → isar-1.16.16.dist-info}/RECORD +9 -9
- {isar-1.16.15.dist-info → isar-1.16.16.dist-info}/WHEEL +1 -1
- {isar-1.16.15.dist-info → isar-1.16.16.dist-info}/LICENSE +0 -0
- {isar-1.16.15.dist-info → isar-1.16.16.dist-info}/top_level.txt +0 -0
isar/storage/blob_storage.py
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import logging
|
|
2
2
|
from pathlib import Path
|
|
3
|
+
from typing import Union
|
|
3
4
|
|
|
4
5
|
from azure.core.exceptions import ResourceExistsError
|
|
5
6
|
from azure.storage.blob import BlobClient, BlobServiceClient, ContainerClient
|
|
@@ -7,10 +8,10 @@ from injector import inject
|
|
|
7
8
|
|
|
8
9
|
from isar.config.keyvault.keyvault_service import Keyvault
|
|
9
10
|
from isar.config.settings import settings
|
|
10
|
-
from robot_interface.models.mission.mission import Mission
|
|
11
11
|
from isar.storage.storage_interface import StorageException, StorageInterface
|
|
12
12
|
from isar.storage.utilities import construct_metadata_file, construct_paths
|
|
13
13
|
from robot_interface.models.inspection.inspection import Inspection
|
|
14
|
+
from robot_interface.models.mission.mission import Mission
|
|
14
15
|
|
|
15
16
|
|
|
16
17
|
class BlobStorage(StorageInterface):
|
|
@@ -31,7 +32,7 @@ class BlobStorage(StorageInterface):
|
|
|
31
32
|
|
|
32
33
|
self.logger = logging.getLogger("uploader")
|
|
33
34
|
|
|
34
|
-
def store(self, inspection: Inspection, mission: Mission) -> str:
|
|
35
|
+
def store(self, inspection: Inspection, mission: Mission) -> Union[str, dict]:
|
|
35
36
|
data_path, metadata_path = construct_paths(
|
|
36
37
|
inspection=inspection, mission=mission
|
|
37
38
|
)
|
|
@@ -43,7 +44,7 @@ class BlobStorage(StorageInterface):
|
|
|
43
44
|
self._upload_file(path=metadata_path, data=metadata_bytes)
|
|
44
45
|
return self._upload_file(path=data_path, data=inspection.data)
|
|
45
46
|
|
|
46
|
-
def _upload_file(self, path: Path, data: bytes) -> str:
|
|
47
|
+
def _upload_file(self, path: Path, data: bytes) -> Union[str, dict]:
|
|
47
48
|
blob_client = self._get_blob_client(path)
|
|
48
49
|
try:
|
|
49
50
|
blob_properties = blob_client.upload_blob(data=data)
|
|
@@ -55,7 +56,14 @@ class BlobStorage(StorageInterface):
|
|
|
55
56
|
except Exception as e:
|
|
56
57
|
self.logger.error("An unexpected error occurred while uploading blob")
|
|
57
58
|
raise StorageException from e
|
|
58
|
-
|
|
59
|
+
|
|
60
|
+
absolute_inspection_path = {
|
|
61
|
+
"source": "blob",
|
|
62
|
+
"blob_storage_account_url": settings.BLOB_STORAGE_ACCOUNT_URL,
|
|
63
|
+
"blob_container": settings.BLOB_CONTAINER,
|
|
64
|
+
"blob_name": blob_client.blob_name,
|
|
65
|
+
}
|
|
66
|
+
return absolute_inspection_path
|
|
59
67
|
|
|
60
68
|
def _get_blob_service_client(self) -> BlobServiceClient:
|
|
61
69
|
try:
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
from abc import ABCMeta, abstractmethod
|
|
2
|
+
from typing import Union
|
|
2
3
|
|
|
3
|
-
from robot_interface.models.mission.mission import Mission
|
|
4
4
|
from robot_interface.models.inspection.inspection import Inspection
|
|
5
|
+
from robot_interface.models.mission.mission import Mission
|
|
5
6
|
|
|
6
7
|
|
|
7
8
|
class StorageInterface(metaclass=ABCMeta):
|
|
8
9
|
@abstractmethod
|
|
9
|
-
def store(self, inspection: Inspection, mission: Mission) -> str:
|
|
10
|
+
def store(self, inspection: Inspection, mission: Mission) -> Union[str, dict]:
|
|
10
11
|
"""
|
|
11
12
|
Parameters
|
|
12
13
|
----------
|
isar/storage/uploader.py
CHANGED
|
@@ -3,7 +3,7 @@ import logging
|
|
|
3
3
|
from dataclasses import dataclass
|
|
4
4
|
from datetime import datetime, timedelta
|
|
5
5
|
from queue import Empty, Queue
|
|
6
|
-
from typing import List
|
|
6
|
+
from typing import List, Union
|
|
7
7
|
|
|
8
8
|
from injector import inject
|
|
9
9
|
|
|
@@ -100,8 +100,8 @@ class Uploader:
|
|
|
100
100
|
except Empty:
|
|
101
101
|
continue
|
|
102
102
|
|
|
103
|
-
def _upload(self, upload_item: UploaderQueueItem) -> str:
|
|
104
|
-
inspection_path = ""
|
|
103
|
+
def _upload(self, upload_item: UploaderQueueItem) -> Union[str, dict]:
|
|
104
|
+
inspection_path: Union[str, dict] = ""
|
|
105
105
|
try:
|
|
106
106
|
inspection_path = upload_item.storage_handler.store(
|
|
107
107
|
inspection=upload_item.inspection, mission=upload_item.mission
|
|
@@ -140,7 +140,7 @@ class Uploader:
|
|
|
140
140
|
)
|
|
141
141
|
|
|
142
142
|
def _publish_inspection_result(
|
|
143
|
-
self, inspection: Inspection, inspection_path: str
|
|
143
|
+
self, inspection: Inspection, inspection_path: Union[str, dict]
|
|
144
144
|
) -> None:
|
|
145
145
|
"""Publishes the reference of the inspection result to the MQTT Broker
|
|
146
146
|
along with the analysis type
|
isar/storage/utilities.py
CHANGED
|
@@ -79,4 +79,5 @@ def get_filename(
|
|
|
79
79
|
|
|
80
80
|
|
|
81
81
|
def get_foldername(mission: Mission) -> str:
|
|
82
|
-
|
|
82
|
+
mission_name: str = mission.name.replace(" ", "-")
|
|
83
|
+
return f"{datetime.utcnow().date()}__{settings.PLANT_SHORT_NAME}__{mission_name}__{mission.id}"
|
|
@@ -78,12 +78,12 @@ isar/state_machine/states/off.py,sha256=jjqN_oJMpBtWuY7hP-c9f0w3p2CYCfe-NpmYHHPn
|
|
|
78
78
|
isar/state_machine/states/paused.py,sha256=xVZM9WMt90FTiP5forSlA3eJ5Vt9LzZYCFDQDPIocKA,1004
|
|
79
79
|
isar/state_machine/states/stop.py,sha256=Sxdo4FGhxc2Pj91jidYtVIjpSNklbEf1sJYJ6x51HgE,3348
|
|
80
80
|
isar/storage/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
81
|
-
isar/storage/blob_storage.py,sha256=
|
|
81
|
+
isar/storage/blob_storage.py,sha256=oKdml1VVN8iTr-d_5H4Lz5E7zrhJRknCzOxHD-tO7m8,3230
|
|
82
82
|
isar/storage/local_storage.py,sha256=fLzVuwvdEk9l8z7od1qX2p5MeWzcsx-vN4yWvelZeFM,1836
|
|
83
83
|
isar/storage/slimm_storage.py,sha256=Hp7ZIgZgIR4KAFjzxDKfgMZjPZwP2kmdc1gG8zVcsMk,8966
|
|
84
|
-
isar/storage/storage_interface.py,sha256=
|
|
85
|
-
isar/storage/uploader.py,sha256=
|
|
86
|
-
isar/storage/utilities.py,sha256=
|
|
84
|
+
isar/storage/storage_interface.py,sha256=DYDry4I7aZpDHJhsBF6s8zrgokFAc7fdKJKfA8AvL7o,828
|
|
85
|
+
isar/storage/uploader.py,sha256=Jpjml4fwPOeApHWfYWEO4gCfIxJKotujUTz2-5TTCt0,6345
|
|
86
|
+
isar/storage/utilities.py,sha256=xnJHT_lu985k0Jlq7_Seu_nWVlocOCVAR8yz2zLkv5Q,3108
|
|
87
87
|
robot_interface/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
88
88
|
robot_interface/robot_interface.py,sha256=i2qw1V9mLO-ljtS7LiRliQ7XNmmBJIwD4NG8mDfwMEI,8317
|
|
89
89
|
robot_interface/test_robot_interface.py,sha256=FV1urn7SbsMyWBIcTKjsBwAG4IsXeZ6pLHE0mA9EGGs,692
|
|
@@ -107,8 +107,8 @@ robot_interface/telemetry/payloads.py,sha256=9EshERifjD1u8CwjSiV3NGuj0KuXnwblQNB
|
|
|
107
107
|
robot_interface/utilities/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
108
108
|
robot_interface/utilities/json_service.py,sha256=nU2Q_3P9Fq9hs6F_wtUjWtHfl_g1Siy-yDhXXSKwHwg,1018
|
|
109
109
|
robot_interface/utilities/uuid_string_factory.py,sha256=_NQIbBQ56w0qqO0MUDP6aPpHbxW7ATRhK8HnQiBSLkc,76
|
|
110
|
-
isar-1.16.
|
|
111
|
-
isar-1.16.
|
|
112
|
-
isar-1.16.
|
|
113
|
-
isar-1.16.
|
|
114
|
-
isar-1.16.
|
|
110
|
+
isar-1.16.16.dist-info/LICENSE,sha256=3fc2-ebLwHWwzfQbulGNRdcNob3SBQeCfEVUDYxsuqw,14058
|
|
111
|
+
isar-1.16.16.dist-info/METADATA,sha256=fLeCxrQbsKkMJql1a7UVagNLjQvbU0HpphQI0v7FiFI,14752
|
|
112
|
+
isar-1.16.16.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
|
113
|
+
isar-1.16.16.dist-info/top_level.txt,sha256=UwIML2RtuQKCyJJkatcSnyp6-ldDjboB9k9JgKipO-U,21
|
|
114
|
+
isar-1.16.16.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|