isar 1.17.0__py3-none-any.whl → 1.18.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.

Potentially problematic release.


This version of isar might be problematic. Click here for more details.

isar/config/settings.py CHANGED
@@ -56,6 +56,9 @@ class Settings(BaseSettings):
56
56
  # Number of attempts to initiate a step or mission before cancelling
57
57
  INITIATE_FAILURE_COUNTER_LIMIT: int = Field(default=10)
58
58
 
59
+ # Number of attempts to request a step status in monitor before cancelling
60
+ REQUEST_STATUS_FAILURE_COUNTER_LIMIT: int = Field(default=3)
61
+
59
62
  # Number of attempts to stop the robot before giving up
60
63
  STOP_ROBOT_ATTEMPTS_LIMIT: int = Field(default=10)
61
64
 
@@ -7,6 +7,7 @@ from injector import inject
7
7
  from transitions import State
8
8
 
9
9
  from isar.mission_planner.task_selector_interface import TaskSelectorStop
10
+ from isar.config.settings import settings
10
11
  from isar.services.utilities.threaded_request import (
11
12
  ThreadedRequest,
12
13
  ThreadedRequestNotFinishedError,
@@ -17,6 +18,7 @@ from robot_interface.models.exceptions.robot_exceptions import (
17
18
  RobotMissionStatusException,
18
19
  RobotRetrieveInspectionException,
19
20
  RobotStepStatusException,
21
+ RobotCommunicationTimeoutException,
20
22
  )
21
23
  from robot_interface.models.inspection.inspection import Inspection
22
24
  from robot_interface.models.mission.mission import Mission
@@ -32,6 +34,10 @@ class Monitor(State):
32
34
  def __init__(self, state_machine: "StateMachine") -> None:
33
35
  super().__init__(name="monitor", on_enter=self.start, on_exit=self.stop)
34
36
  self.state_machine: "StateMachine" = state_machine
37
+ self.request_status_failure_counter: int = 0
38
+ self.request_status_failure_counter_limit: int = (
39
+ settings.REQUEST_STATUS_FAILURE_COUNTER_LIMIT
40
+ )
35
41
 
36
42
  self.logger = logging.getLogger("state_machine")
37
43
  self.step_status_thread: Optional[ThreadedRequest] = None
@@ -61,7 +67,6 @@ class Monitor(State):
61
67
  status_function=self.state_machine.robot.step_status,
62
68
  thread_name="State Machine Monitor Get Step Status",
63
69
  )
64
-
65
70
  try:
66
71
  status: Union[StepStatus, MissionStatus] = (
67
72
  self.step_status_thread.get_output()
@@ -70,6 +75,34 @@ class Monitor(State):
70
75
  time.sleep(self.state_machine.sleep_time)
71
76
  continue
72
77
 
78
+ except RobotCommunicationTimeoutException as e:
79
+ self.state_machine.current_mission.error_message = ErrorMessage(
80
+ error_reason=e.error_reason, error_description=e.error_description
81
+ )
82
+ self.step_status_thread = None
83
+ self.request_status_failure_counter += 1
84
+ self.logger.warning(
85
+ f"Monitoring step {self.state_machine.current_step.id} failed #: "
86
+ f"{self.request_status_failure_counter} failed because: {e.error_description}"
87
+ )
88
+
89
+ if (
90
+ self.request_status_failure_counter
91
+ >= self.request_status_failure_counter_limit
92
+ ):
93
+ self.state_machine.current_step.error_message = ErrorMessage(
94
+ error_reason=e.error_reason,
95
+ error_description=e.error_description,
96
+ )
97
+ self.logger.error(
98
+ f"Step will be cancelled after failing to get step status "
99
+ f"{self.request_status_failure_counter} times because: "
100
+ f"{e.error_description}"
101
+ )
102
+ status = StepStatus.Failed
103
+ else:
104
+ continue
105
+
73
106
  except RobotStepStatusException as e:
74
107
  self.state_machine.current_step.error_message = ErrorMessage(
75
108
  error_reason=e.error_reason, error_description=e.error_description
@@ -98,6 +131,8 @@ class Monitor(State):
98
131
  f"Retrieving the status failed because: {e.error_description}"
99
132
  )
100
133
 
134
+ self.request_status_failure_counter = 0
135
+
101
136
  if isinstance(status, StepStatus):
102
137
  self.state_machine.current_step.status = status
103
138
  elif isinstance(status, MissionStatus):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: isar
3
- Version: 1.17.0
3
+ Version: 1.18.0
4
4
  Summary: Integration and Supervisory control of Autonomous Robots
5
5
  Home-page: https://github.com/equinor/isar
6
6
  Author: Equinor ASA
@@ -14,7 +14,7 @@ isar/config/configuration_error.py,sha256=rO6WOhafX6xvVib8WxV-eY483Z0PpN-9PxGsq5
14
14
  isar/config/log.py,sha256=39G_Cue0qvw0Uv-1NYXvQ83yivPIKcAv-bGNNREFw5o,2251
15
15
  isar/config/logging.conf,sha256=mYO1xf27gAopEMHhGzY7-mwyfN16rwRLkPNMvy3zn2g,1127
16
16
  isar/config/settings.env,sha256=-kivj0osAAKlInnY81ugySTlcImhVABbnj9kUoBDLu8,535
17
- isar/config/settings.py,sha256=ZECul4dywwZb-hJeWi-4XfjrUjthqMs42bNfsyI7feA,13056
17
+ isar/config/settings.py,sha256=eiVXkjcKpUDOTchzWYooaZZ3xdEXjD8Uv4V7ynHuXwY,13201
18
18
  isar/config/certs/ca-cert.pem,sha256=gSBTyY0tKSFnssyvrvbFvHpQwii0kEkBryklVmevdtc,2029
19
19
  isar/config/keyvault/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
20
20
  isar/config/keyvault/keyvault_error.py,sha256=zvPCsZLjboxsxthYkxpRERCTFxYV8R5WmACewAUQLwk,41
@@ -73,7 +73,7 @@ isar/state_machine/states/__init__.py,sha256=gUikQDu-O-lmunwzwcN9gN6VaEmlCFlqqgd
73
73
  isar/state_machine/states/idle.py,sha256=tfciqI7NPDVF8WMe5qbSO3c-xDzUTQYLmJinb9e0JS8,1231
74
74
  isar/state_machine/states/initialize.py,sha256=Vx7OxWZI_xEkRwHWFh9ymxK_7mDH0Wayt09dGGqBJWk,2359
75
75
  isar/state_machine/states/initiate.py,sha256=b0Fq3tN6TZMg5j4192OsYdGbphTXWCkftBsFX57mhrw,5652
76
- isar/state_machine/states/monitor.py,sha256=ykVQe54Lm_V-X7kJ16GMkycG7T9Kz3g2hsPtL35NSSk,9004
76
+ isar/state_machine/states/monitor.py,sha256=iuGiIEWSp6_rC6CLz5DNfb71Dttlo0KFxfg7xYwiZYE,10665
77
77
  isar/state_machine/states/off.py,sha256=jjqN_oJMpBtWuY7hP-c9f0w3p2CYCfe-NpmYHHPnmyI,544
78
78
  isar/state_machine/states/paused.py,sha256=xVZM9WMt90FTiP5forSlA3eJ5Vt9LzZYCFDQDPIocKA,1004
79
79
  isar/state_machine/states/stop.py,sha256=Sxdo4FGhxc2Pj91jidYtVIjpSNklbEf1sJYJ6x51HgE,3348
@@ -89,7 +89,7 @@ robot_interface/robot_interface.py,sha256=i2qw1V9mLO-ljtS7LiRliQ7XNmmBJIwD4NG8mD
89
89
  robot_interface/test_robot_interface.py,sha256=FV1urn7SbsMyWBIcTKjsBwAG4IsXeZ6pLHE0mA9EGGs,692
90
90
  robot_interface/models/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
91
91
  robot_interface/models/exceptions/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
92
- robot_interface/models/exceptions/robot_exceptions.py,sha256=olW9I6VrAsNPZ4c_4Yr9Uor_0vES84wjqWesqHqSFag,8535
92
+ robot_interface/models/exceptions/robot_exceptions.py,sha256=l1h62gq7lfLzWoHh2ytdEWgn_4lS4M-GPxHkjgAXcP4,9036
93
93
  robot_interface/models/initialize/__init__.py,sha256=rz5neEDr59GDbzzI_FF0DId-C-I-50l113P-h-C_QBY,48
94
94
  robot_interface/models/initialize/initialize_params.py,sha256=2eG5Aq5bDKU6tVkaUMAoc46GERBgyaKkqv6yLupdRLc,164
95
95
  robot_interface/models/inspection/__init__.py,sha256=14wfuj4XZazrigKD7fL98khFKz-eckIpEgPcYRj40Kg,227
@@ -107,8 +107,8 @@ robot_interface/telemetry/payloads.py,sha256=eMK7mjZPsLY6yvu7AK-OcdvkeUpChzDrySD
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.17.0.dist-info/LICENSE,sha256=3fc2-ebLwHWwzfQbulGNRdcNob3SBQeCfEVUDYxsuqw,14058
111
- isar-1.17.0.dist-info/METADATA,sha256=hXe-kwMnV9ZxNxA2o4KmiZXiQhAqVG6hh5xhlp6hTdo,14751
112
- isar-1.17.0.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
113
- isar-1.17.0.dist-info/top_level.txt,sha256=UwIML2RtuQKCyJJkatcSnyp6-ldDjboB9k9JgKipO-U,21
114
- isar-1.17.0.dist-info/RECORD,,
110
+ isar-1.18.0.dist-info/LICENSE,sha256=3fc2-ebLwHWwzfQbulGNRdcNob3SBQeCfEVUDYxsuqw,14058
111
+ isar-1.18.0.dist-info/METADATA,sha256=wjDHWKgNqxMggWZ3Rboq-AFVnuuRLeY7j0lzV3py7Z0,14751
112
+ isar-1.18.0.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
113
+ isar-1.18.0.dist-info/top_level.txt,sha256=UwIML2RtuQKCyJJkatcSnyp6-ldDjboB9k9JgKipO-U,21
114
+ isar-1.18.0.dist-info/RECORD,,
@@ -5,6 +5,7 @@ from typing import Optional
5
5
 
6
6
  class ErrorReason(str, Enum):
7
7
  RobotCommunicationException: str = "robot_communication_exception"
8
+ RobotCommunicationTimeoutException: str = "robot_communication_timeout_exception"
8
9
  RobotInfeasibleStepException: str = "robot_infeasible_step_exception"
9
10
  RobotInfeasibleMissionException: str = "robot_infeasible_mission_exception"
10
11
  RobotMissionStatusException: str = "robot_mission_status_exception"
@@ -49,6 +50,18 @@ class RobotCommunicationException(RobotException):
49
50
  pass
50
51
 
51
52
 
53
+ # An exception which should be thrown by the robot package if the communication has timed
54
+ # out and ISAR should retry the request.
55
+ class RobotCommunicationTimeoutException(RobotException):
56
+ def __init__(self, error_description: str) -> None:
57
+ super().__init__(
58
+ error_reason=ErrorReason.RobotCommunicationTimeoutException,
59
+ error_description=error_description,
60
+ )
61
+
62
+ pass
63
+
64
+
52
65
  # An exception which should be thrown by the robot package if it is unable to start the
53
66
  # current step.
54
67
  class RobotInfeasibleStepException(RobotException):
File without changes
File without changes