Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add PV for the web dashboard to get current config details #403

Merged
merged 4 commits into from
Dec 17, 2024
Merged
Show file tree
Hide file tree
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
12 changes: 11 additions & 1 deletion block_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
CONFIG_PUSH_TIME = 300 # 5 minutes
INST_SCRIPT_PUSH_TIME = 604800 # 7 days

# This IOC gets special treatment as it needs to be reloaded on every single config change, regardless of whether

Check failure on line 79 in block_server.py

View workflow job for this annotation

GitHub Actions / call-workflow / ruff

Ruff (E501)

block_server.py:79:101: E501 Line too long (113 > 100)
# it's macros have changed or not. For details see https://github.com/ISISComputingGroup/IBEX/issues/5590
CAEN_DISCRIMINATOR_IOC_NAME = "CAENV895_01"

Expand All @@ -84,7 +84,7 @@
initial_dbs = {
BlockserverPVNames.BLOCKNAMES: char_waveform(16000),
BlockserverPVNames.HEARTBEAT: {"type": "int", "count": 1, "value": [0]},
BlockserverPVNames.BLOCK_DETAILS: char_waveform(16000),
BlockserverPVNames.WD_CONF_DETAILS: char_waveform(16000),
BlockserverPVNames.GROUPS: char_waveform(16000),
BlockserverPVNames.COMPS: char_waveform(16000),
BlockserverPVNames.LOAD_CONFIG: char_waveform(1000),
Expand Down Expand Up @@ -116,7 +116,7 @@
class BlockServer(Driver):
"""The class for handling all the static PV access and monitors etc."""

def __init__(self, ca_server):

Check failure on line 119 in block_server.py

View workflow job for this annotation

GitHub Actions / call-workflow / ruff

Ruff (ANN204)

block_server.py:119:9: ANN204 Missing return type annotation for special method `__init__`

Check failure on line 119 in block_server.py

View workflow job for this annotation

GitHub Actions / call-workflow / ruff

Ruff (ANN001)

block_server.py:119:24: ANN001 Missing type annotation for function argument `ca_server`
"""Constructor.

Args:
Expand Down Expand Up @@ -192,7 +192,7 @@
self._config_list = ConfigListManager(self, ConfigurationFileManager())
except Exception as err:
print_and_log(
"Error creating inactive config list. Configuration list changes will not be stored "

Check failure on line 195 in block_server.py

View workflow job for this annotation

GitHub Actions / call-workflow / ruff

Ruff (E501)

block_server.py:195:101: E501 Line too long (101 > 100)
+ "in version control: %s " % str(err),
"MINOR",
)
Expand All @@ -214,7 +214,7 @@
)
self._component_switcher.create_monitors()

def initialise_configserver(self, facility):

Check failure on line 217 in block_server.py

View workflow job for this annotation

GitHub Actions / call-workflow / ruff

Ruff (ANN201)

block_server.py:217:9: ANN201 Missing return type annotation for public function `initialise_configserver`

Check failure on line 217 in block_server.py

View workflow job for this annotation

GitHub Actions / call-workflow / ruff

Ruff (ANN001)

block_server.py:217:39: ANN001 Missing type annotation for function argument `facility`
"""Initialises the ActiveConfigHolder.

Args:
Expand Down Expand Up @@ -262,14 +262,14 @@
self._active_configserver.clear_config()
self._initialise_config()

def read(self, reason):

Check failure on line 265 in block_server.py

View workflow job for this annotation

GitHub Actions / call-workflow / ruff

Ruff (ANN201)

block_server.py:265:9: ANN201 Missing return type annotation for public function `read`

Check failure on line 265 in block_server.py

View workflow job for this annotation

GitHub Actions / call-workflow / ruff

Ruff (ANN001)

block_server.py:265:20: ANN001 Missing type annotation for function argument `reason`
"""A method called by SimpleServer when a PV is read from the BlockServer over Channel Access.

Check failure on line 266 in block_server.py

View workflow job for this annotation

GitHub Actions / call-workflow / ruff

Ruff (E501)

block_server.py:266:101: E501 Line too long (102 > 100)

Args:
reason (string): The PV that is being requested (without the PV prefix)

Returns:
string : A compressed and hexed JSON formatted string that gives the desired information based on reason.

Check failure on line 272 in block_server.py

View workflow job for this annotation

GitHub Actions / call-workflow / ruff

Ruff (E501)

block_server.py:272:101: E501 Line too long (117 > 100)
If an Exception is thrown in the reading of the information this is returned in compressed and hexed JSON.
"""
try:
Expand Down Expand Up @@ -465,6 +465,7 @@
self.update_blocks_monitors()

self.update_get_details_monitors()
self.update_wd_details_monitors()
self.update_curr_config_name_monitors()
self._active_configserver.update_archiver(full_init)
for handler in self.on_the_fly_handlers:
Expand Down Expand Up @@ -656,6 +657,15 @@
)
self.updatePVs()

def update_wd_details_monitors(self):
"""Updates the monitor for the active configuration, so the web dashboard can see any changes."""
with self.monitor_lock:
config_details_json = convert_to_json({k: v for k, v in self._active_configserver.get_config_details(exclude_macros=True).items() if k not in ["component_iocs", "iocs"]})
self.setParam(
BlockserverPVNames.WD_CONF_DETAILS, compress_and_hex(config_details_json)
)
self.updatePVs()

def update_curr_config_name_monitors(self):
"""Updates the monitor for the active configuration name, so the clients can see any changes."""
with self.monitor_lock:
Expand Down
2 changes: 1 addition & 1 deletion server_common/pv_names.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class BlockserverPVNames:
"""Holds and manages blockserver PV names"""

BLOCKNAMES = prepend_blockserver("BLOCKNAMES")
BLOCK_DETAILS = prepend_blockserver("BLOCK_DETAILS")
WD_CONF_DETAILS = prepend_blockserver("WD_CONF_DETAILS")
BLOCK_RULES = prepend_blockserver("BLOCK_RULES")
GROUPS = prepend_blockserver("GROUPS")
GROUP_RULES = prepend_blockserver("GROUP_RULES")
Expand Down
Loading