Skip to content

Commit 43df5a1

Browse files
committed
Free up the *Radio namespace for future config structures
Ongoing monitoring radio work (see PR #3315) introduces per-radio configuration classes using *Radio names. This PR frees up the *Radio namespace for that use, by renaming non-user-exposed internal classes out of the way.
1 parent 987d14a commit 43df5a1

File tree

4 files changed

+25
-25
lines changed

4 files changed

+25
-25
lines changed

parsl/executors/base.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
from typing_extensions import Literal, Self
77

8-
from parsl.monitoring.radios import MonitoringRadio
8+
from parsl.monitoring.radios import MonitoringRadioSender
99

1010

1111
class ParslExecutor(metaclass=ABCMeta):
@@ -52,7 +52,7 @@ def __init__(
5252
*,
5353
hub_address: Optional[str] = None,
5454
hub_zmq_port: Optional[int] = None,
55-
monitoring_radio: Optional[MonitoringRadio] = None,
55+
monitoring_radio: Optional[MonitoringRadioSender] = None,
5656
run_dir: str = ".",
5757
run_id: Optional[str] = None,
5858
):
@@ -147,11 +147,11 @@ def hub_zmq_port(self, value: Optional[int]) -> None:
147147
self._hub_zmq_port = value
148148

149149
@property
150-
def monitoring_radio(self) -> Optional[MonitoringRadio]:
150+
def monitoring_radio(self) -> Optional[MonitoringRadioSender]:
151151
"""Local radio for sending monitoring messages
152152
"""
153153
return self._monitoring_radio
154154

155155
@monitoring_radio.setter
156-
def monitoring_radio(self, value: Optional[MonitoringRadio]) -> None:
156+
def monitoring_radio(self, value: Optional[MonitoringRadioSender]) -> None:
157157
self._monitoring_radio = value

parsl/monitoring/monitoring.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
from parsl.log_utils import set_file_logger
1515
from parsl.monitoring.message_type import MessageType
16-
from parsl.monitoring.radios import MultiprocessingQueueRadio
16+
from parsl.monitoring.radios import MultiprocessingQueueRadioSender
1717
from parsl.monitoring.router import router_starter
1818
from parsl.monitoring.types import AddressedMonitoringMessage
1919
from parsl.multiprocessing import ForkProcess, SizedQueue
@@ -187,7 +187,7 @@ def start(self, run_id: str, dfk_run_dir: str, config_run_dir: Union[str, os.Pat
187187
self.filesystem_proc.start()
188188
logger.info(f"Started filesystem radio receiver process {self.filesystem_proc.pid}")
189189

190-
self.radio = MultiprocessingQueueRadio(self.block_msgs)
190+
self.radio = MultiprocessingQueueRadioSender(self.block_msgs)
191191

192192
try:
193193
comm_q_result = comm_q.get(block=True, timeout=120)

parsl/monitoring/radios.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,14 @@
1515
logger = logging.getLogger(__name__)
1616

1717

18-
class MonitoringRadio(metaclass=ABCMeta):
18+
class MonitoringRadioSender(metaclass=ABCMeta):
1919
@abstractmethod
2020
def send(self, message: object) -> None:
2121
pass
2222

2323

24-
class FilesystemRadio(MonitoringRadio):
25-
"""A MonitoringRadio that sends messages over a shared filesystem.
24+
class FilesystemRadioSender(MonitoringRadioSender):
25+
"""A MonitoringRadioSender that sends messages over a shared filesystem.
2626
2727
The messsage directory structure is based on maildir,
2828
https://en.wikipedia.org/wiki/Maildir
@@ -36,7 +36,7 @@ class FilesystemRadio(MonitoringRadio):
3636
This avoids a race condition of reading partially written messages.
3737
3838
This radio is likely to give higher shared filesystem load compared to
39-
the UDPRadio, but should be much more reliable.
39+
the UDP radio, but should be much more reliable.
4040
"""
4141

4242
def __init__(self, *, monitoring_url: str, source_id: int, timeout: int = 10, run_dir: str):
@@ -66,7 +66,7 @@ def send(self, message: object) -> None:
6666
os.rename(tmp_filename, new_filename)
6767

6868

69-
class HTEXRadio(MonitoringRadio):
69+
class HTEXRadioSender(MonitoringRadioSender):
7070

7171
def __init__(self, monitoring_url: str, source_id: int, timeout: int = 10):
7272
"""
@@ -120,7 +120,7 @@ def send(self, message: object) -> None:
120120
return
121121

122122

123-
class UDPRadio(MonitoringRadio):
123+
class UDPRadioSender(MonitoringRadioSender):
124124

125125
def __init__(self, monitoring_url: str, source_id: int, timeout: int = 10):
126126
"""
@@ -174,7 +174,7 @@ def send(self, message: object) -> None:
174174
return
175175

176176

177-
class MultiprocessingQueueRadio(MonitoringRadio):
177+
class MultiprocessingQueueRadioSender(MonitoringRadioSender):
178178
"""A monitoring radio which connects over a multiprocessing Queue.
179179
This radio is intended to be used on the submit side, where components
180180
in the submit process, or processes launched by multiprocessing, will have

parsl/monitoring/remote.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@
88

99
from parsl.monitoring.message_type import MessageType
1010
from parsl.monitoring.radios import (
11-
FilesystemRadio,
12-
HTEXRadio,
13-
MonitoringRadio,
14-
UDPRadio,
11+
FilesystemRadioSender,
12+
HTEXRadioSender,
13+
MonitoringRadioSender,
14+
UDPRadioSender,
1515
)
1616
from parsl.multiprocessing import ForkProcess
1717
from parsl.process_loggers import wrap_with_logs
@@ -100,17 +100,17 @@ def wrapped(*args: List[Any], **kwargs: Dict[str, Any]) -> Any:
100100
return (wrapped, args, new_kwargs)
101101

102102

103-
def get_radio(radio_mode: str, monitoring_hub_url: str, task_id: int, run_dir: str) -> MonitoringRadio:
104-
radio: MonitoringRadio
103+
def get_radio(radio_mode: str, monitoring_hub_url: str, task_id: int, run_dir: str) -> MonitoringRadioSender:
104+
radio: MonitoringRadioSender
105105
if radio_mode == "udp":
106-
radio = UDPRadio(monitoring_hub_url,
107-
source_id=task_id)
106+
radio = UDPRadioSender(monitoring_hub_url,
107+
source_id=task_id)
108108
elif radio_mode == "htex":
109-
radio = HTEXRadio(monitoring_hub_url,
110-
source_id=task_id)
109+
radio = HTEXRadioSender(monitoring_hub_url,
110+
source_id=task_id)
111111
elif radio_mode == "filesystem":
112-
radio = FilesystemRadio(monitoring_url=monitoring_hub_url,
113-
source_id=task_id, run_dir=run_dir)
112+
radio = FilesystemRadioSender(monitoring_url=monitoring_hub_url,
113+
source_id=task_id, run_dir=run_dir)
114114
else:
115115
raise RuntimeError(f"Unknown radio mode: {radio_mode}")
116116
return radio

0 commit comments

Comments
 (0)