isar 1.32.0__py3-none-any.whl → 1.32.2__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/apis/models/start_mission_definition.py +4 -0
- isar/models/events.py +4 -4
- isar/services/utilities/scheduling_utilities.py +3 -3
- isar/state_machine/state_machine.py +1 -1
- isar/state_machine/states/await_next_mission.py +3 -3
- isar/state_machine/states/home.py +3 -3
- isar/state_machine/states/intervention_needed.py +3 -3
- isar/state_machine/states/monitor.py +2 -2
- isar/state_machine/states/paused.py +2 -2
- isar/state_machine/states/returning_home.py +2 -2
- isar/state_machine/states/robot_standing_still.py +3 -3
- isar/state_machine/states/unknown_status.py +1 -1
- isar/state_machine/transitions/functions/pause.py +1 -1
- isar/state_machine/transitions/functions/resume.py +1 -1
- isar/state_machine/transitions/functions/start_mission.py +4 -4
- isar/state_machine/transitions/functions/stop.py +12 -6
- isar/state_machine/transitions/mission.py +4 -4
- isar/state_machine/utils/common_event_handlers.py +2 -2
- isar/storage/blob_storage.py +29 -31
- isar/storage/local_storage.py +5 -2
- isar/storage/storage_interface.py +3 -3
- {isar-1.32.0.dist-info → isar-1.32.2.dist-info}/METADATA +1 -1
- {isar-1.32.0.dist-info → isar-1.32.2.dist-info}/RECORD +27 -27
- {isar-1.32.0.dist-info → isar-1.32.2.dist-info}/WHEEL +0 -0
- {isar-1.32.0.dist-info → isar-1.32.2.dist-info}/entry_points.txt +0 -0
- {isar-1.32.0.dist-info → isar-1.32.2.dist-info}/licenses/LICENSE +0 -0
- {isar-1.32.0.dist-info → isar-1.32.2.dist-info}/top_level.txt +0 -0
|
@@ -53,6 +53,7 @@ class StartMissionTaskDefinition(BaseModel):
|
|
|
53
53
|
|
|
54
54
|
|
|
55
55
|
class StartMissionDefinition(BaseModel):
|
|
56
|
+
id: Optional[str] = None
|
|
56
57
|
tasks: List[StartMissionTaskDefinition]
|
|
57
58
|
name: Optional[str] = None
|
|
58
59
|
start_pose: Optional[InputPose] = None
|
|
@@ -84,7 +85,10 @@ def to_isar_mission(
|
|
|
84
85
|
if start_mission_definition.start_pose:
|
|
85
86
|
start_pose = start_mission_definition.start_pose.to_alitra_pose()
|
|
86
87
|
|
|
88
|
+
id = start_mission_definition.id if start_mission_definition.id else uuid4_string()
|
|
89
|
+
|
|
87
90
|
return Mission(
|
|
91
|
+
id=id,
|
|
88
92
|
tasks=isar_tasks,
|
|
89
93
|
name=isar_mission_name,
|
|
90
94
|
start_pose=start_pose,
|
isar/models/events.py
CHANGED
|
@@ -70,13 +70,13 @@ class Events:
|
|
|
70
70
|
|
|
71
71
|
class APIEvent(Generic[T1, T2]):
|
|
72
72
|
"""
|
|
73
|
-
Creates
|
|
74
|
-
api to state machine while the
|
|
73
|
+
Creates request and response event. The events are defined such that the request is from
|
|
74
|
+
api to state machine while the response is from state machine to api.
|
|
75
75
|
"""
|
|
76
76
|
|
|
77
77
|
def __init__(self):
|
|
78
|
-
self.
|
|
79
|
-
self.
|
|
78
|
+
self.request: Event[T1] = Event()
|
|
79
|
+
self.response: Event[T2] = Event()
|
|
80
80
|
|
|
81
81
|
|
|
82
82
|
class APIRequests:
|
|
@@ -311,11 +311,11 @@ class SchedulingUtilities:
|
|
|
311
311
|
)
|
|
312
312
|
|
|
313
313
|
def _send_command(self, input: T1, api_event: APIEvent[T1, T2]) -> T2:
|
|
314
|
-
api_event.
|
|
314
|
+
api_event.request.trigger_event(input)
|
|
315
315
|
try:
|
|
316
|
-
return api_event.
|
|
316
|
+
return api_event.response.consume_event(timeout=self.queue_timeout)
|
|
317
317
|
except EventTimeoutError as e:
|
|
318
318
|
self.logger.error("Queue timed out")
|
|
319
|
-
api_event.
|
|
319
|
+
api_event.request.clear_event()
|
|
320
320
|
self.logger.error("No output received for command to state machine")
|
|
321
321
|
raise e
|
|
@@ -368,7 +368,7 @@ class StateMachine(object):
|
|
|
368
368
|
)
|
|
369
369
|
|
|
370
370
|
def _queue_empty_response(self) -> None:
|
|
371
|
-
self.events.api_requests.stop_mission.
|
|
371
|
+
self.events.api_requests.stop_mission.response.put(
|
|
372
372
|
ControlMissionResponse(
|
|
373
373
|
mission_id="None",
|
|
374
374
|
mission_status="None",
|
|
@@ -24,17 +24,17 @@ class AwaitNextMission(EventHandlerBase):
|
|
|
24
24
|
event_handlers: List[EventHandlerMapping] = [
|
|
25
25
|
EventHandlerMapping(
|
|
26
26
|
name="start_mission_event",
|
|
27
|
-
event=events.api_requests.start_mission.
|
|
27
|
+
event=events.api_requests.start_mission.request,
|
|
28
28
|
handler=lambda event: start_mission_event_handler(state_machine, event),
|
|
29
29
|
),
|
|
30
30
|
EventHandlerMapping(
|
|
31
31
|
name="return_home_event",
|
|
32
|
-
event=events.api_requests.return_home.
|
|
32
|
+
event=events.api_requests.return_home.request,
|
|
33
33
|
handler=lambda event: return_home_event_handler(state_machine, event),
|
|
34
34
|
),
|
|
35
35
|
EventHandlerMapping(
|
|
36
36
|
name="stop_mission_event",
|
|
37
|
-
event=events.api_requests.return_home.
|
|
37
|
+
event=events.api_requests.return_home.request,
|
|
38
38
|
handler=lambda event: stop_mission_event_handler(state_machine, event),
|
|
39
39
|
),
|
|
40
40
|
]
|
|
@@ -22,17 +22,17 @@ class Home(EventHandlerBase):
|
|
|
22
22
|
event_handlers: List[EventHandlerMapping] = [
|
|
23
23
|
EventHandlerMapping(
|
|
24
24
|
name="start_mission_event",
|
|
25
|
-
event=events.api_requests.start_mission.
|
|
25
|
+
event=events.api_requests.start_mission.request,
|
|
26
26
|
handler=lambda event: start_mission_event_handler(state_machine, event),
|
|
27
27
|
),
|
|
28
28
|
EventHandlerMapping(
|
|
29
29
|
name="return_home_event",
|
|
30
|
-
event=events.api_requests.return_home.
|
|
30
|
+
event=events.api_requests.return_home.request,
|
|
31
31
|
handler=lambda event: return_home_event_handler(state_machine, event),
|
|
32
32
|
),
|
|
33
33
|
EventHandlerMapping(
|
|
34
34
|
name="stop_mission_event",
|
|
35
|
-
event=events.api_requests.return_home.
|
|
35
|
+
event=events.api_requests.return_home.request,
|
|
36
36
|
handler=lambda event: stop_mission_event_handler(state_machine, event),
|
|
37
37
|
),
|
|
38
38
|
EventHandlerMapping(
|
|
@@ -18,7 +18,7 @@ class InterventionNeeded(EventHandlerBase):
|
|
|
18
18
|
event: Event[bool],
|
|
19
19
|
) -> Optional[Callable]:
|
|
20
20
|
if event.consume_event():
|
|
21
|
-
state_machine.events.api_requests.release_intervention_needed.
|
|
21
|
+
state_machine.events.api_requests.release_intervention_needed.response.trigger_event(
|
|
22
22
|
True
|
|
23
23
|
)
|
|
24
24
|
return state_machine.release_intervention_needed # type: ignore
|
|
@@ -27,12 +27,12 @@ class InterventionNeeded(EventHandlerBase):
|
|
|
27
27
|
event_handlers: List[EventHandlerMapping] = [
|
|
28
28
|
EventHandlerMapping(
|
|
29
29
|
name="return_home_event",
|
|
30
|
-
event=events.api_requests.return_home.
|
|
30
|
+
event=events.api_requests.return_home.request,
|
|
31
31
|
handler=lambda event: return_home_event_handler(state_machine, event),
|
|
32
32
|
),
|
|
33
33
|
EventHandlerMapping(
|
|
34
34
|
name="release_intervention_needed_event",
|
|
35
|
-
event=events.api_requests.release_intervention_needed.
|
|
35
|
+
event=events.api_requests.release_intervention_needed.request,
|
|
36
36
|
handler=release_intervention_needed_handler,
|
|
37
37
|
),
|
|
38
38
|
]
|
|
@@ -49,12 +49,12 @@ class Monitor(EventHandlerBase):
|
|
|
49
49
|
event_handlers: List[EventHandlerMapping] = [
|
|
50
50
|
EventHandlerMapping(
|
|
51
51
|
name="stop_mission_event",
|
|
52
|
-
event=events.api_requests.stop_mission.
|
|
52
|
+
event=events.api_requests.stop_mission.request,
|
|
53
53
|
handler=lambda event: stop_mission_event_handler(state_machine, event),
|
|
54
54
|
),
|
|
55
55
|
EventHandlerMapping(
|
|
56
56
|
name="pause_mission_event",
|
|
57
|
-
event=events.api_requests.pause_mission.
|
|
57
|
+
event=events.api_requests.pause_mission.request,
|
|
58
58
|
handler=_pause_mission_event_handler,
|
|
59
59
|
),
|
|
60
60
|
EventHandlerMapping(
|
|
@@ -14,12 +14,12 @@ class Paused(EventHandlerBase):
|
|
|
14
14
|
event_handlers: List[EventHandlerMapping] = [
|
|
15
15
|
EventHandlerMapping(
|
|
16
16
|
name="stop_mission_event",
|
|
17
|
-
event=events.api_requests.stop_mission.
|
|
17
|
+
event=events.api_requests.stop_mission.request,
|
|
18
18
|
handler=lambda event: state_machine.stop if event.consume_event() else None, # type: ignore
|
|
19
19
|
),
|
|
20
20
|
EventHandlerMapping(
|
|
21
21
|
name="resume_mission_event",
|
|
22
|
-
event=events.api_requests.resume_mission.
|
|
22
|
+
event=events.api_requests.resume_mission.request,
|
|
23
23
|
handler=lambda event: state_machine.resume if event.consume_event() else None, # type: ignore
|
|
24
24
|
),
|
|
25
25
|
]
|
|
@@ -41,7 +41,7 @@ class ReturningHome(EventHandlerBase):
|
|
|
41
41
|
event_handlers: List[EventHandlerMapping] = [
|
|
42
42
|
EventHandlerMapping(
|
|
43
43
|
name="stop_mission_event",
|
|
44
|
-
event=events.api_requests.stop_mission.
|
|
44
|
+
event=events.api_requests.stop_mission.request,
|
|
45
45
|
handler=lambda event: stop_mission_event_handler(state_machine, event),
|
|
46
46
|
),
|
|
47
47
|
EventHandlerMapping(
|
|
@@ -60,7 +60,7 @@ class ReturningHome(EventHandlerBase):
|
|
|
60
60
|
),
|
|
61
61
|
EventHandlerMapping(
|
|
62
62
|
name="start_mission_event",
|
|
63
|
-
event=events.api_requests.start_mission.
|
|
63
|
+
event=events.api_requests.start_mission.request,
|
|
64
64
|
handler=_start_mission_event_handler,
|
|
65
65
|
),
|
|
66
66
|
EventHandlerMapping(
|
|
@@ -22,17 +22,17 @@ class RobotStandingStill(EventHandlerBase):
|
|
|
22
22
|
event_handlers: List[EventHandlerMapping] = [
|
|
23
23
|
EventHandlerMapping(
|
|
24
24
|
name="start_mission_event",
|
|
25
|
-
event=events.api_requests.start_mission.
|
|
25
|
+
event=events.api_requests.start_mission.request,
|
|
26
26
|
handler=lambda event: start_mission_event_handler(state_machine, event),
|
|
27
27
|
),
|
|
28
28
|
EventHandlerMapping(
|
|
29
29
|
name="return_home_event",
|
|
30
|
-
event=events.api_requests.return_home.
|
|
30
|
+
event=events.api_requests.return_home.request,
|
|
31
31
|
handler=lambda event: return_home_event_handler(state_machine, event),
|
|
32
32
|
),
|
|
33
33
|
EventHandlerMapping(
|
|
34
34
|
name="stop_mission_event",
|
|
35
|
-
event=events.api_requests.return_home.
|
|
35
|
+
event=events.api_requests.return_home.request,
|
|
36
36
|
handler=lambda event: stop_mission_event_handler(state_machine, event),
|
|
37
37
|
),
|
|
38
38
|
EventHandlerMapping(
|
|
@@ -31,7 +31,7 @@ class UnknownStatus(EventHandlerBase):
|
|
|
31
31
|
event_handlers: List[EventHandlerMapping] = [
|
|
32
32
|
EventHandlerMapping(
|
|
33
33
|
name="stop_mission_event",
|
|
34
|
-
event=events.api_requests.stop_mission.
|
|
34
|
+
event=events.api_requests.stop_mission.request,
|
|
35
35
|
handler=lambda event: stop_mission_event_handler(state_machine, event),
|
|
36
36
|
),
|
|
37
37
|
EventHandlerMapping(
|
|
@@ -29,7 +29,7 @@ def pause_mission(state_machine: "StateMachine") -> bool:
|
|
|
29
29
|
paused_mission_response: ControlMissionResponse = (
|
|
30
30
|
state_machine._make_control_mission_response()
|
|
31
31
|
)
|
|
32
|
-
state_machine.events.api_requests.pause_mission.
|
|
32
|
+
state_machine.events.api_requests.pause_mission.response.put(
|
|
33
33
|
paused_mission_response
|
|
34
34
|
)
|
|
35
35
|
|
|
@@ -35,7 +35,7 @@ def resume_mission(state_machine: "StateMachine") -> bool:
|
|
|
35
35
|
resume_mission_response: ControlMissionResponse = (
|
|
36
36
|
state_machine._make_control_mission_response()
|
|
37
37
|
)
|
|
38
|
-
state_machine.events.api_requests.resume_mission.
|
|
38
|
+
state_machine.events.api_requests.resume_mission.response.put(
|
|
39
39
|
resume_mission_response
|
|
40
40
|
)
|
|
41
41
|
|
|
@@ -11,12 +11,12 @@ from robot_interface.models.exceptions.robot_exceptions import (
|
|
|
11
11
|
from robot_interface.models.mission.status import MissionStatus, TaskStatus
|
|
12
12
|
|
|
13
13
|
|
|
14
|
-
def
|
|
15
|
-
state_machine.events.api_requests.start_mission.
|
|
14
|
+
def acknowledge_mission(state_machine: "StateMachine") -> bool:
|
|
15
|
+
state_machine.events.api_requests.start_mission.response.put(True)
|
|
16
16
|
return True
|
|
17
17
|
|
|
18
18
|
|
|
19
|
-
def
|
|
19
|
+
def prepare_state_machine_before_mission(state_machine: "StateMachine") -> bool:
|
|
20
20
|
state_machine.logger.info(
|
|
21
21
|
"Initiating mission:\n"
|
|
22
22
|
f" Mission ID: {state_machine.current_mission.id}\n"
|
|
@@ -70,5 +70,5 @@ def trigger_start_mission_event(state_machine: "StateMachine") -> bool:
|
|
|
70
70
|
|
|
71
71
|
|
|
72
72
|
def _initialization_failed(state_machine: "StateMachine") -> None:
|
|
73
|
-
state_machine.events.api_requests.start_mission.
|
|
73
|
+
state_machine.events.api_requests.start_mission.response.put(False)
|
|
74
74
|
state_machine._finalize()
|
|
@@ -31,7 +31,9 @@ def stop_mission_cleanup(state_machine: "StateMachine") -> bool:
|
|
|
31
31
|
stopped_mission_response: ControlMissionResponse = (
|
|
32
32
|
state_machine._make_control_mission_response()
|
|
33
33
|
)
|
|
34
|
-
state_machine.events.api_requests.stop_mission.
|
|
34
|
+
state_machine.events.api_requests.stop_mission.response.put(
|
|
35
|
+
stopped_mission_response
|
|
36
|
+
)
|
|
35
37
|
state_machine.publish_task_status(task=state_machine.current_task)
|
|
36
38
|
state_machine._finalize()
|
|
37
39
|
return True
|
|
@@ -41,7 +43,9 @@ def stop_mission_failed(state_machine: "StateMachine") -> bool:
|
|
|
41
43
|
stopped_mission_response: ControlMissionResponse = (
|
|
42
44
|
state_machine._make_control_mission_response()
|
|
43
45
|
)
|
|
44
|
-
state_machine.events.api_requests.stop_mission.
|
|
46
|
+
state_machine.events.api_requests.stop_mission.response.put(
|
|
47
|
+
stopped_mission_response
|
|
48
|
+
)
|
|
45
49
|
return True
|
|
46
50
|
|
|
47
51
|
|
|
@@ -51,7 +55,7 @@ def stop_return_home_mission_cleanup(state_machine: "StateMachine") -> bool:
|
|
|
51
55
|
state_machine.reset_state_machine()
|
|
52
56
|
return True
|
|
53
57
|
|
|
54
|
-
if not state_machine.events.api_requests.start_mission.
|
|
58
|
+
if not state_machine.events.api_requests.start_mission.request.has_event():
|
|
55
59
|
state_machine.current_mission.status = MissionStatus.Cancelled
|
|
56
60
|
|
|
57
61
|
for task in state_machine.current_mission.tasks:
|
|
@@ -65,7 +69,7 @@ def stop_return_home_mission_cleanup(state_machine: "StateMachine") -> bool:
|
|
|
65
69
|
stopped_mission_response: ControlMissionResponse = (
|
|
66
70
|
state_machine._make_control_mission_response()
|
|
67
71
|
)
|
|
68
|
-
state_machine.events.api_requests.stop_mission.
|
|
72
|
+
state_machine.events.api_requests.stop_mission.response.put(
|
|
69
73
|
stopped_mission_response
|
|
70
74
|
)
|
|
71
75
|
|
|
@@ -74,10 +78,12 @@ def stop_return_home_mission_cleanup(state_machine: "StateMachine") -> bool:
|
|
|
74
78
|
|
|
75
79
|
|
|
76
80
|
def stop_return_home_mission_failed(state_machine: "StateMachine") -> bool:
|
|
77
|
-
if state_machine.events.api_requests.start_mission.
|
|
81
|
+
if state_machine.events.api_requests.start_mission.request.has_event():
|
|
78
82
|
return True
|
|
79
83
|
stopped_mission_response: ControlMissionResponse = (
|
|
80
84
|
state_machine._make_control_mission_response()
|
|
81
85
|
)
|
|
82
|
-
state_machine.events.api_requests.stop_mission.
|
|
86
|
+
state_machine.events.api_requests.stop_mission.response.put(
|
|
87
|
+
stopped_mission_response
|
|
88
|
+
)
|
|
83
89
|
return True
|
|
@@ -7,9 +7,9 @@ from isar.state_machine.transitions.functions.finish_mission import finish_missi
|
|
|
7
7
|
from isar.state_machine.transitions.functions.pause import pause_mission
|
|
8
8
|
from isar.state_machine.transitions.functions.resume import resume_mission
|
|
9
9
|
from isar.state_machine.transitions.functions.start_mission import (
|
|
10
|
+
acknowledge_mission,
|
|
10
11
|
initialize_robot,
|
|
11
|
-
|
|
12
|
-
put_start_mission_on_queue,
|
|
12
|
+
prepare_state_machine_before_mission,
|
|
13
13
|
set_mission_to_in_progress,
|
|
14
14
|
trigger_start_mission_event,
|
|
15
15
|
)
|
|
@@ -94,9 +94,9 @@ def get_mission_transitions(state_machine: "StateMachine") -> List[dict]:
|
|
|
94
94
|
state_machine.robot_standing_still_state,
|
|
95
95
|
],
|
|
96
96
|
"dest": state_machine.monitor_state,
|
|
97
|
-
"prepare": def_transition(state_machine,
|
|
97
|
+
"prepare": def_transition(state_machine, acknowledge_mission),
|
|
98
98
|
"conditions": [
|
|
99
|
-
def_transition(state_machine,
|
|
99
|
+
def_transition(state_machine, prepare_state_machine_before_mission),
|
|
100
100
|
def_transition(state_machine, initialize_robot),
|
|
101
101
|
],
|
|
102
102
|
"before": [
|
|
@@ -24,7 +24,7 @@ def return_home_event_handler(
|
|
|
24
24
|
state_machine: "StateMachine", event: Event[bool]
|
|
25
25
|
) -> Optional[Callable]:
|
|
26
26
|
if event.consume_event():
|
|
27
|
-
state_machine.events.api_requests.return_home.
|
|
27
|
+
state_machine.events.api_requests.return_home.response.put(True)
|
|
28
28
|
return state_machine.request_return_home # type: ignore
|
|
29
29
|
return None
|
|
30
30
|
|
|
@@ -48,7 +48,7 @@ def stop_mission_event_handler(
|
|
|
48
48
|
if state_machine.current_mission.id == mission_id or mission_id == "":
|
|
49
49
|
return state_machine.stop # type: ignore
|
|
50
50
|
else:
|
|
51
|
-
state_machine.events.api_requests.stop_mission.
|
|
51
|
+
state_machine.events.api_requests.stop_mission.response.put(
|
|
52
52
|
ControlMissionResponse(
|
|
53
53
|
mission_id=mission_id,
|
|
54
54
|
mission_status=state_machine.current_mission.status,
|
isar/storage/blob_storage.py
CHANGED
|
@@ -3,34 +3,49 @@ from pathlib import Path
|
|
|
3
3
|
from typing import Union
|
|
4
4
|
|
|
5
5
|
from azure.core.exceptions import ResourceExistsError
|
|
6
|
-
from azure.storage.blob import
|
|
6
|
+
from azure.storage.blob import BlobServiceClient
|
|
7
7
|
|
|
8
8
|
from isar.config.keyvault.keyvault_service import Keyvault
|
|
9
9
|
from isar.config.settings import settings
|
|
10
10
|
from isar.storage.storage_interface import StorageException, StorageInterface
|
|
11
11
|
from isar.storage.utilities import construct_metadata_file, construct_paths
|
|
12
|
-
from robot_interface.models.inspection.inspection import
|
|
12
|
+
from robot_interface.models.inspection.inspection import InspectionBlob
|
|
13
13
|
from robot_interface.models.mission.mission import Mission
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
class BlobStorage(StorageInterface):
|
|
17
|
-
def __init__(
|
|
18
|
-
self
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
self.storage_connection_string = self.keyvault.get_secret(
|
|
17
|
+
def __init__(self, keyvault: Keyvault) -> None:
|
|
18
|
+
self.logger = logging.getLogger("uploader")
|
|
19
|
+
|
|
20
|
+
storage_connection_string = keyvault.get_secret(
|
|
22
21
|
"AZURE-STORAGE-CONNECTION-STRING"
|
|
23
22
|
).value
|
|
24
|
-
self.container_name = container_name
|
|
25
23
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
24
|
+
if storage_connection_string is None:
|
|
25
|
+
raise RuntimeError("AZURE-STORAGE-CONNECTION-STRING from keyvault is None")
|
|
26
|
+
|
|
27
|
+
try:
|
|
28
|
+
blob_service_client = BlobServiceClient.from_connection_string(
|
|
29
|
+
storage_connection_string
|
|
30
|
+
)
|
|
31
|
+
except Exception as e:
|
|
32
|
+
self.logger.error("Unable to retrieve blob service client. Error: %s", e)
|
|
33
|
+
raise e
|
|
34
|
+
|
|
35
|
+
self.container_client = blob_service_client.get_container_client(
|
|
36
|
+
settings.BLOB_CONTAINER
|
|
29
37
|
)
|
|
30
38
|
|
|
31
|
-
|
|
39
|
+
if not self.container_client.exists():
|
|
40
|
+
raise RuntimeError(
|
|
41
|
+
"The configured blob container %s does not exist",
|
|
42
|
+
settings.BLOB_CONTAINER,
|
|
43
|
+
)
|
|
44
|
+
|
|
45
|
+
def store(self, inspection: InspectionBlob, mission: Mission) -> Union[str, dict]:
|
|
46
|
+
if inspection.data is None:
|
|
47
|
+
raise StorageException("Nothing to store. The inspection data is empty")
|
|
32
48
|
|
|
33
|
-
def store(self, inspection: Inspection, mission: Mission) -> Union[str, dict]:
|
|
34
49
|
data_path, metadata_path = construct_paths(
|
|
35
50
|
inspection=inspection, mission=mission
|
|
36
51
|
)
|
|
@@ -43,7 +58,7 @@ class BlobStorage(StorageInterface):
|
|
|
43
58
|
return self._upload_file(path=data_path, data=inspection.data)
|
|
44
59
|
|
|
45
60
|
def _upload_file(self, path: Path, data: bytes) -> Union[str, dict]:
|
|
46
|
-
blob_client = self.
|
|
61
|
+
blob_client = self.container_client.get_blob_client(path.as_posix())
|
|
47
62
|
try:
|
|
48
63
|
blob_client.upload_blob(data=data)
|
|
49
64
|
except ResourceExistsError as e:
|
|
@@ -62,20 +77,3 @@ class BlobStorage(StorageInterface):
|
|
|
62
77
|
"blob_name": blob_client.blob_name,
|
|
63
78
|
}
|
|
64
79
|
return absolute_inspection_path
|
|
65
|
-
|
|
66
|
-
def _get_blob_service_client(self) -> BlobServiceClient:
|
|
67
|
-
try:
|
|
68
|
-
return BlobServiceClient.from_connection_string(
|
|
69
|
-
self.storage_connection_string
|
|
70
|
-
)
|
|
71
|
-
except Exception as e:
|
|
72
|
-
self.logger.error("Unable to retrieve blob service client. Error: %s", e)
|
|
73
|
-
raise e
|
|
74
|
-
|
|
75
|
-
def _get_container_client(
|
|
76
|
-
self, blob_service_client: BlobServiceClient
|
|
77
|
-
) -> ContainerClient:
|
|
78
|
-
return blob_service_client.get_container_client(self.container_name)
|
|
79
|
-
|
|
80
|
-
def _get_blob_client(self, path_to_blob: Path) -> BlobClient:
|
|
81
|
-
return self.container_client.get_blob_client(path_to_blob.as_posix())
|
isar/storage/local_storage.py
CHANGED
|
@@ -4,7 +4,7 @@ from pathlib import Path
|
|
|
4
4
|
from isar.config.settings import settings
|
|
5
5
|
from isar.storage.storage_interface import StorageException, StorageInterface
|
|
6
6
|
from isar.storage.utilities import construct_metadata_file, construct_paths
|
|
7
|
-
from robot_interface.models.inspection.inspection import
|
|
7
|
+
from robot_interface.models.inspection.inspection import InspectionBlob
|
|
8
8
|
from robot_interface.models.mission.mission import Mission
|
|
9
9
|
|
|
10
10
|
|
|
@@ -13,7 +13,10 @@ class LocalStorage(StorageInterface):
|
|
|
13
13
|
self.root_folder: Path = Path(settings.LOCAL_STORAGE_PATH)
|
|
14
14
|
self.logger = logging.getLogger("uploader")
|
|
15
15
|
|
|
16
|
-
def store(self, inspection:
|
|
16
|
+
def store(self, inspection: InspectionBlob, mission: Mission) -> str:
|
|
17
|
+
if inspection.data is None:
|
|
18
|
+
raise StorageException("Nothing to store. The inspection data is empty")
|
|
19
|
+
|
|
17
20
|
local_path, local_metadata_path = construct_paths(
|
|
18
21
|
inspection=inspection, mission=mission
|
|
19
22
|
)
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
from abc import ABCMeta, abstractmethod
|
|
2
2
|
from typing import Union
|
|
3
3
|
|
|
4
|
-
from robot_interface.models.inspection.inspection import
|
|
4
|
+
from robot_interface.models.inspection.inspection import InspectionBlob
|
|
5
5
|
from robot_interface.models.mission.mission import Mission
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
class StorageInterface(metaclass=ABCMeta):
|
|
9
9
|
@abstractmethod
|
|
10
|
-
def store(self, inspection:
|
|
10
|
+
def store(self, inspection: InspectionBlob, mission: Mission) -> Union[str, dict]:
|
|
11
11
|
"""
|
|
12
12
|
Parameters
|
|
13
13
|
----------
|
|
14
14
|
mission : Mission
|
|
15
15
|
Mission the inspection is a part of.
|
|
16
|
-
inspection :
|
|
16
|
+
inspection : InspectionBlob
|
|
17
17
|
The inspection object to be stored.
|
|
18
18
|
|
|
19
19
|
Returns
|
|
@@ -5,7 +5,7 @@ isar/apis/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
|
5
5
|
isar/apis/api.py,sha256=VM_WBlHJ4Juv9A0FvaUTeaMVYCN6a7pAojxIGCmDtf0,14154
|
|
6
6
|
isar/apis/models/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
7
7
|
isar/apis/models/models.py,sha256=GMOss2C8lBeRFV7E37mLwSOM6RhiyLQLcLBRzm_51d4,1835
|
|
8
|
-
isar/apis/models/start_mission_definition.py,sha256=
|
|
8
|
+
isar/apis/models/start_mission_definition.py,sha256=v-wt1XDd53Sw7DCdFAkxBBut-xd_uGJa7qMJnE3VI9k,6364
|
|
9
9
|
isar/apis/robot_control/robot_controller.py,sha256=0EHjMqOBdfJlMrCItGPz5X-4X2kc-2XlNnUU2LOcLfc,1219
|
|
10
10
|
isar/apis/schedule/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
11
11
|
isar/apis/schedule/scheduling_controller.py,sha256=S93DNyOWqVYAe3EnBnWuoCHLkeVFFjkR7ayBRw9J7f4,10603
|
|
@@ -42,7 +42,7 @@ isar/mission_planner/mission_planner_interface.py,sha256=UgpPIM4FbrWOD7fGY3Ul64k
|
|
|
42
42
|
isar/mission_planner/sequential_task_selector.py,sha256=66agRPHuJnEa1vArPyty4muTasAZ50XPjjrSaTdY_Cc,643
|
|
43
43
|
isar/mission_planner/task_selector_interface.py,sha256=pnLeaGPIuyXThcflZ_A7YL2b2xQjFT88hAZidkMomxU,707
|
|
44
44
|
isar/models/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
45
|
-
isar/models/events.py,sha256=
|
|
45
|
+
isar/models/events.py,sha256=Q9YaHSsjI6gS-mZ16HLEXpbSBuEFcgHMxG_MeEEfdBo,3870
|
|
46
46
|
isar/robot/robot.py,sha256=keqsYmfRlyIC4CWkMG0erDt_4uIC0IPvyG2ni4MemyI,5350
|
|
47
47
|
isar/robot/robot_start_mission.py,sha256=RPYH9VtXDFdPqhOpt6kSbT17RHkJQPKkQ6d4784_pFE,3210
|
|
48
48
|
isar/robot/robot_status.py,sha256=NMZZOV1DHOVrJwMsSjKbDSaSiWYnrfAW1cQHtc6heKk,1903
|
|
@@ -59,43 +59,43 @@ isar/services/service_connections/mqtt/robot_heartbeat_publisher.py,sha256=_bUOG
|
|
|
59
59
|
isar/services/service_connections/mqtt/robot_info_publisher.py,sha256=AxokGk51hRPTxxD2r0P9braPJCMrf1InaCxrUBKkF4g,1402
|
|
60
60
|
isar/services/utilities/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
61
61
|
isar/services/utilities/robot_utilities.py,sha256=4zCigsLXfqDC8POHchktSq81zr1_pTaRve_LQsVr6Mk,514
|
|
62
|
-
isar/services/utilities/scheduling_utilities.py,sha256=
|
|
62
|
+
isar/services/utilities/scheduling_utilities.py,sha256=jxwvVahRJeuoYDtOcVyLwm1BTFKKq92icjR-bA_R0bg,11674
|
|
63
63
|
isar/services/utilities/threaded_request.py,sha256=py4G-_RjnIdHljmKFAcQ6ddqMmp-ZYV39Ece-dqRqjs,1874
|
|
64
64
|
isar/state_machine/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
65
|
-
isar/state_machine/state_machine.py,sha256
|
|
65
|
+
isar/state_machine/state_machine.py,sha256=vrsQfDyUUHOh20nEZ0qZaMUmSb2KkMx1fnWHyfHdRWc,16670
|
|
66
66
|
isar/state_machine/states_enum.py,sha256=4XZ6dGGjXVZ8PwQCnAIH3MMNbMP2h3bmmPHFk6m_RlY,481
|
|
67
67
|
isar/state_machine/states/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
68
|
-
isar/state_machine/states/await_next_mission.py,sha256=
|
|
68
|
+
isar/state_machine/states/await_next_mission.py,sha256=VfsJFHh_G371bUVkJgh_5o7d0DLNeMexV35Bw6Jsj7M,1879
|
|
69
69
|
isar/state_machine/states/blocked_protective_stop.py,sha256=GEOvxnHXjpCsrh3aa8Idtn1zMYv5HLQzj9qQAq8HvaU,1180
|
|
70
|
-
isar/state_machine/states/home.py,sha256=
|
|
71
|
-
isar/state_machine/states/intervention_needed.py,sha256=
|
|
72
|
-
isar/state_machine/states/monitor.py,sha256=
|
|
70
|
+
isar/state_machine/states/home.py,sha256=tbwWoxQdrZb4zkqgXpDjzTZD-IqKTgHoC_MmFdTEjKQ,1868
|
|
71
|
+
isar/state_machine/states/intervention_needed.py,sha256=A0QYz1vD1tDKAealihXDuoGuMLtXrRfn_AwFoaUhT_Q,1640
|
|
72
|
+
isar/state_machine/states/monitor.py,sha256=366CZSEf1HRVqpm0RkFjIDGnc_9fjeer7qwu1fvbcKQ,3670
|
|
73
73
|
isar/state_machine/states/offline.py,sha256=5wdNzC1wG0cWrpuT_r_mk8UNFHA4QSyg8ejXUTAg4Io,1137
|
|
74
|
-
isar/state_machine/states/paused.py,sha256=
|
|
75
|
-
isar/state_machine/states/returning_home.py,sha256=
|
|
76
|
-
isar/state_machine/states/robot_standing_still.py,sha256=
|
|
74
|
+
isar/state_machine/states/paused.py,sha256=osmLZhm0-2jcZmNRauveeidCBYayDZvLy-1TNYv6CgQ,1091
|
|
75
|
+
isar/state_machine/states/returning_home.py,sha256=6NEszX7phRN46ST25YFZZja75Z1RHSswWSv7V1-26wU,3424
|
|
76
|
+
isar/state_machine/states/robot_standing_still.py,sha256=78W465FlVBCTUpmjQHzO5MT7fI6_M8Rh9gS-M8Y9irs,1903
|
|
77
77
|
isar/state_machine/states/stopping.py,sha256=fMXXvcXtzML-Q5A-uRD_gXePy51fnt9jhOTVFN-3qqA,2420
|
|
78
|
-
isar/state_machine/states/unknown_status.py,sha256=
|
|
79
|
-
isar/state_machine/transitions/mission.py,sha256=
|
|
78
|
+
isar/state_machine/states/unknown_status.py,sha256=Y-g9cgme5zriyZ6YUzFRYhOvv9ZylCSwfaY8MJ7xEJ0,1791
|
|
79
|
+
isar/state_machine/transitions/mission.py,sha256=mUOtEyK2UX_kdK-_L4wq5a60882H2KnlxImO72YMtuo,5557
|
|
80
80
|
isar/state_machine/transitions/return_home.py,sha256=Vy_Q_mmTj4wsWL8qxUkmC1CTXEzGsdKNYb4V4rw2IeE,3202
|
|
81
81
|
isar/state_machine/transitions/robot_status.py,sha256=c1ceyWRGCtx-KTDtxHXRD7oPbt8TQ2ej24A0wyim8vc,2720
|
|
82
82
|
isar/state_machine/transitions/functions/fail_mission.py,sha256=jHHXhfQVYQEzCXgTEhv5e6uEK9p6iDPFFXqS9bzs_-A,720
|
|
83
83
|
isar/state_machine/transitions/functions/finish_mission.py,sha256=TRQrk7HdllmAkwsp25HRZAFAk46Y1hLx3jmkIAKrHDI,1442
|
|
84
|
-
isar/state_machine/transitions/functions/pause.py,sha256=
|
|
85
|
-
isar/state_machine/transitions/functions/resume.py,sha256=
|
|
84
|
+
isar/state_machine/transitions/functions/pause.py,sha256=gWr-s76gL0-otrZxCBNmTxUicrAVsdNWDQmHSAOvs6E,1977
|
|
85
|
+
isar/state_machine/transitions/functions/resume.py,sha256=ji4GjQvQQCr_jYRUGYHSYt-vePtO2z7VAUeKF-hyLBw,2106
|
|
86
86
|
isar/state_machine/transitions/functions/return_home.py,sha256=UlniwYvpz74hxqgN0TyVv3LCmiMsqsosKEtEGLqkNj0,1139
|
|
87
87
|
isar/state_machine/transitions/functions/robot_status.py,sha256=P1Cu8xVysbiKRKL4E8mSyoL2-72HfxrLvvOcdnBOlvw,889
|
|
88
|
-
isar/state_machine/transitions/functions/start_mission.py,sha256=
|
|
89
|
-
isar/state_machine/transitions/functions/stop.py,sha256=
|
|
88
|
+
isar/state_machine/transitions/functions/start_mission.py,sha256=PcD9ANNN3Hxyq6hzvpISMiR94-y1BPNupU-wlRysqT8,2581
|
|
89
|
+
isar/state_machine/transitions/functions/stop.py,sha256=ZG33TK3VuJwT-LAQ0a3thgt714yCIu42_bo-u1-V1J0,2956
|
|
90
90
|
isar/state_machine/transitions/functions/utils.py,sha256=Wa72Ocq4QT1E6qkpEJZQ3h5o33pGvx7Tlkt2JZ2Grbk,314
|
|
91
|
-
isar/state_machine/utils/common_event_handlers.py,sha256=
|
|
91
|
+
isar/state_machine/utils/common_event_handlers.py,sha256=hyzOvj5EA4Ob9DjbtbnPKge_t6Umd0_Cc-b6wfy8CP8,5777
|
|
92
92
|
isar/storage/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
93
|
-
isar/storage/blob_storage.py,sha256=
|
|
94
|
-
isar/storage/local_storage.py,sha256
|
|
95
|
-
isar/storage/storage_interface.py,sha256=
|
|
93
|
+
isar/storage/blob_storage.py,sha256=QueyHzCJfUUyOLxBeYwK0Ot7w_CYakBEhtTtITelKAo,3026
|
|
94
|
+
isar/storage/local_storage.py,sha256=-9Bz2WmniLKwKMeAdrgoMzkj781AOLIUsfaqQERqpUk,1985
|
|
95
|
+
isar/storage/storage_interface.py,sha256=DRIiy0mRZL3KMZysG0R2Cque6hoqd5haZBw11WM53Vc,840
|
|
96
96
|
isar/storage/uploader.py,sha256=uD1DzvJ2yYtNAwQGa7UD7kNOxZfKxJ1cCdi7sfOVZ10,9443
|
|
97
97
|
isar/storage/utilities.py,sha256=oLH0Rp7UtrQQdilfITnmXO1Z0ExdeDhBImYHid55vBA,3449
|
|
98
|
-
isar-1.32.
|
|
98
|
+
isar-1.32.2.dist-info/licenses/LICENSE,sha256=3fc2-ebLwHWwzfQbulGNRdcNob3SBQeCfEVUDYxsuqw,14058
|
|
99
99
|
robot_interface/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
100
100
|
robot_interface/robot_interface.py,sha256=-jCAKkZ2eiyzUyHVQmOzw4hMgLWR7pE8MHj-WZo85ZY,7978
|
|
101
101
|
robot_interface/test_robot_interface.py,sha256=FV1urn7SbsMyWBIcTKjsBwAG4IsXeZ6pLHE0mA9EGGs,692
|
|
@@ -119,8 +119,8 @@ robot_interface/telemetry/payloads.py,sha256=Fqkfv77_T2Ttk5EjWRU5HH0XAxFhIuz7k-L
|
|
|
119
119
|
robot_interface/utilities/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
120
120
|
robot_interface/utilities/json_service.py,sha256=qkzVkb60Gi_pto-b5n1vNzCrQze2yqgIJqSLNLYj1Fg,1034
|
|
121
121
|
robot_interface/utilities/uuid_string_factory.py,sha256=_NQIbBQ56w0qqO0MUDP6aPpHbxW7ATRhK8HnQiBSLkc,76
|
|
122
|
-
isar-1.32.
|
|
123
|
-
isar-1.32.
|
|
124
|
-
isar-1.32.
|
|
125
|
-
isar-1.32.
|
|
126
|
-
isar-1.32.
|
|
122
|
+
isar-1.32.2.dist-info/METADATA,sha256=C5qAqtRjXX1tn05-zP-T56xgi1Gwh0WkjE1yHi_LfhI,31217
|
|
123
|
+
isar-1.32.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
124
|
+
isar-1.32.2.dist-info/entry_points.txt,sha256=TFam7uNNw7J0iiDYzsH2gfG0u1eV1wh3JTw_HkhgKLk,49
|
|
125
|
+
isar-1.32.2.dist-info/top_level.txt,sha256=UwIML2RtuQKCyJJkatcSnyp6-ldDjboB9k9JgKipO-U,21
|
|
126
|
+
isar-1.32.2.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|