Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions BlockServer/core/active_config_holder.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,19 @@
# along with this program; if not, you can obtain a copy from
# https://www.eclipse.org/org/documents/epl-v10.php or
# http://opensource.org/licenses/eclipse-1.0.php
import os
from typing import Dict

from BlockServer.config.ioc import IOC
from BlockServer.core.config_holder import ConfigHolder
from BlockServer.core.database_client import get_iocs
from server_common.file_path_manager import FILEPATH_MANAGER
from server_common.constants import IOCS_NOT_TO_STOP
from server_common.helpers import CONTROL_SYSTEM_PREFIX, MACROS, BLOCK_PREFIX
from server_common.utilities import print_and_log

Check failure on line 25 in BlockServer/core/active_config_holder.py

View workflow job for this annotation

GitHub Actions / call-workflow / ruff

Ruff (I001)

BlockServer\core\active_config_holder.py:16:1: I001 Import block is un-sorted or un-formatted


def _blocks_changed(block1, block2) -> bool:

Check failure on line 28 in BlockServer/core/active_config_holder.py

View workflow job for this annotation

GitHub Actions / call-workflow / ruff

Ruff (ANN001)

BlockServer\core\active_config_holder.py:28:29: ANN001 Missing type annotation for function argument `block2`

Check failure on line 28 in BlockServer/core/active_config_holder.py

View workflow job for this annotation

GitHub Actions / call-workflow / ruff

Ruff (ANN001)

BlockServer\core\active_config_holder.py:28:21: ANN001 Missing type annotation for function argument `block1`
"""
Compare two Block objects

Expand All @@ -47,7 +47,7 @@
return False


def _blocks_changed_in_config(old_config, new_config, block_comparator=_blocks_changed) -> bool:

Check failure on line 50 in BlockServer/core/active_config_holder.py

View workflow job for this annotation

GitHub Actions / call-workflow / ruff

Ruff (ANN001)

BlockServer\core\active_config_holder.py:50:55: ANN001 Missing type annotation for function argument `block_comparator`

Check failure on line 50 in BlockServer/core/active_config_holder.py

View workflow job for this annotation

GitHub Actions / call-workflow / ruff

Ruff (ANN001)

BlockServer\core\active_config_holder.py:50:43: ANN001 Missing type annotation for function argument `new_config`

Check failure on line 50 in BlockServer/core/active_config_holder.py

View workflow job for this annotation

GitHub Actions / call-workflow / ruff

Ruff (ANN001)

BlockServer\core\active_config_holder.py:50:31: ANN001 Missing type annotation for function argument `old_config`
"""
Given a new configuration/component and an old one, find out whether blocks have changed between
them.
Expand Down Expand Up @@ -79,7 +79,7 @@
return False


def _compare_ioc_properties(old: Dict[str, IOC], new: Dict[str, IOC]):

Check failure on line 82 in BlockServer/core/active_config_holder.py

View workflow job for this annotation

GitHub Actions / call-workflow / ruff

Ruff (ANN202)

BlockServer\core\active_config_holder.py:82:5: ANN202 Missing return type annotation for private function `_compare_ioc_properties`
"""
Compares the properties of IOCs in a component/configuration.

Expand Down Expand Up @@ -118,7 +118,7 @@
Class to serve up the active configuration.
"""

def __init__(self, macros, archive_manager, file_manager, ioc_control, config_dir) -> None:

Check failure on line 121 in BlockServer/core/active_config_holder.py

View workflow job for this annotation

GitHub Actions / call-workflow / ruff

Ruff (ANN001)

BlockServer\core\active_config_holder.py:121:49: ANN001 Missing type annotation for function argument `file_manager`

Check failure on line 121 in BlockServer/core/active_config_holder.py

View workflow job for this annotation

GitHub Actions / call-workflow / ruff

Ruff (ANN001)

BlockServer\core\active_config_holder.py:121:32: ANN001 Missing type annotation for function argument `archive_manager`

Check failure on line 121 in BlockServer/core/active_config_holder.py

View workflow job for this annotation

GitHub Actions / call-workflow / ruff

Ruff (ANN001)

BlockServer\core\active_config_holder.py:121:24: ANN001 Missing type annotation for function argument `macros`
"""Constructor.

Args:
Expand Down Expand Up @@ -265,8 +265,12 @@
# cached config or components
if ioc_name in iocs_in_current_config:
continue

if self._ioc_control.get_ioc_status(ioc_name) == "RUNNING":
try:
ioc_status = self._ioc_control.get_ioc_status(ioc_name)
except Exception as e:
print_and_log(f"WARNING: IOC {ioc_name} status UNKNOWN: {e} - has IOC been removed?")
ioc_status = "UNKNOWN"
if ioc_status == "RUNNING":
if ioc_name in iocs_in_new_config:
# If the IOC is in the new config, we need to restart it as the new config
# may have macros which were not used when the IOC was manually
Expand Down
Loading