Skip to content

Commit

Permalink
Add workaround for Flotilla database write timing
Browse files Browse the repository at this point in the history
  • Loading branch information
aeshub committed Jun 20, 2022
1 parent 65faab6 commit ce189ad
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
8 changes: 8 additions & 0 deletions src/isar/state_machine/state_machine.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import json
import logging
import queue
import time
from collections import deque
from datetime import datetime
from typing import Deque, List, Optional
Expand Down Expand Up @@ -205,6 +206,13 @@ def _initialization_successful(self) -> None:
f"Initialization successful. Starting new mission: {self.current_mission.id}"
)
self.log_step_overview(mission=self.current_mission)

# This is a workaround to enable the Flotilla repository to write the mission to
# its database before the publishing from ISAR starts. This is not a permanent
# solution and should be further addressed in the following issue.
# https://github.com/equinor/flotilla/issues/226
time.sleep(2)

self.current_mission.status = MissionStatus.InProgress
self.publish_mission_status()
self.current_task = self.current_mission.next_task()
Expand Down
8 changes: 4 additions & 4 deletions tests/isar/state_machine/test_state_machine.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def test_state_machine_transitions(injector, state_machine_thread):
scheduling_utilities: SchedulingUtilities = injector.get(SchedulingUtilities)
scheduling_utilities.start_mission(mission=mission, initial_pose=None)

time.sleep(1)
time.sleep(3)
expected_transitions_list = deque(
[
States.Idle,
Expand All @@ -115,7 +115,7 @@ def test_state_machine_failed_dependency(injector, state_machine_thread, mocker)
scheduling_utilities: SchedulingUtilities = injector.get(SchedulingUtilities)
scheduling_utilities.start_mission(mission=mission, initial_pose=None)

time.sleep(1)
time.sleep(3)
expected_transitions_list = deque(
[
States.Idle,
Expand All @@ -141,7 +141,7 @@ def test_state_machine_with_successful_collection(
scheduling_utilities: SchedulingUtilities = injector.get(SchedulingUtilities)

scheduling_utilities.start_mission(mission=mission, initial_pose=None)
time.sleep(1)
time.sleep(3)
expected_transitions_list = deque(
[
States.Idle,
Expand Down Expand Up @@ -171,7 +171,7 @@ def test_state_machine_with_unsuccessful_collection(
scheduling_utilities: SchedulingUtilities = injector.get(SchedulingUtilities)

scheduling_utilities.start_mission(mission=mission, initial_pose=None)
time.sleep(1)
time.sleep(3)
expected_transitions_list = deque(
[
States.Idle,
Expand Down

0 comments on commit ce189ad

Please sign in to comment.