Skip to content

Commit

Permalink
FIX: fix study not stable bug
Browse files Browse the repository at this point in the history
  • Loading branch information
mbrzus committed May 1, 2024
1 parent 85f213f commit ec2ee3c
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions Kubernetes/study.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,15 +79,14 @@ def __init__(
self.logger = setup_custom_logger(f"study_{self.study_id}")

self.study: pyorthanc.Study | None = (
None # Should be overwritten the _init_study_object function
None # Should be overwritten the _get_orthanc_study_object function
)
self.orthanc: pyorthanc.Orthanc | None = None
self.start_time = time.time()
self.end_time: time.time | None = None

self.max_retries: int = 5
self._init_orthanc_connection()
self._init_study_object()
self._init_study_logger()

# Boilerplate code for the study state
Expand Down Expand Up @@ -139,7 +138,9 @@ def _study_is_stable(self) -> bool:
"""
is_stable: bool = False
try:
self._get_orthanc_study_object()
is_stable = self.study.get_main_information().get("IsStable", False)
self.logger.info(f"Study stable check. STATUS: {is_stable}")
except Exception as get_main_info_e:
msg: str = f"ERROR getting study main information for {self.study_id}: {get_main_info_e}"
self.logger.info(msg)
Expand Down Expand Up @@ -176,7 +177,7 @@ def _init_orthanc_connection(self) -> None:
f"Study {self.study_id} failed to connect to Orthanc at {self.orthanc_url} after {self.max_retries} retries"
)

def _init_study_object(self):
def _get_orthanc_study_object(self):
try:
studies = pyorthanc.find(
self.orthanc,
Expand Down

0 comments on commit ec2ee3c

Please sign in to comment.