Skip to content

Commit e836b9c

Browse files
committed
Make UDP radio receiver shutdown period configurable
.. and use that new parameter in stderr/out tests which don't make use of the UDP radio.
1 parent 04ba3a6 commit e836b9c

File tree

3 files changed

+18
-4
lines changed

3 files changed

+18
-4
lines changed

parsl/monitoring/monitoring.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,8 @@ def __init__(self,
4848
logdir: Optional[str] = None,
4949
monitoring_debug: bool = False,
5050
resource_monitoring_enabled: bool = True,
51-
resource_monitoring_interval: float = 30): # in seconds
51+
resource_monitoring_interval: float = 30, # in seconds
52+
udp_atexit_timeout: float = 3):
5253
"""
5354
Parameters
5455
----------
@@ -87,6 +88,10 @@ def __init__(self,
8788
If set to 0, only start and end information will be logged, and no periodic monitoring will
8889
be made.
8990
Default: 30 seconds
91+
udp_atexit_timeout : float
92+
The amount of time in seconds to wait for more UDP messages at shutdown, after the last DFK
93+
workflow message is received.
94+
9095
"""
9196

9297
if _db_manager_excepts:
@@ -106,6 +111,8 @@ def __init__(self,
106111
self.resource_monitoring_enabled = resource_monitoring_enabled
107112
self.resource_monitoring_interval = resource_monitoring_interval
108113

114+
self.udp_atexit_timeout = udp_atexit_timeout
115+
109116
def start(self, dfk_run_dir: str, config_run_dir: Union[str, os.PathLike]) -> None:
110117

111118
logger.debug("Starting MonitoringHub")
@@ -154,6 +161,7 @@ def start(self, dfk_run_dir: str, config_run_dir: Union[str, os.PathLike]) -> No
154161
"zmq_port_range": self.hub_port_range,
155162
"logdir": self.logdir,
156163
"logging_level": logging.DEBUG if self.monitoring_debug else logging.INFO,
164+
"udp_atexit_timeout": self.udp_atexit_timeout
157165
},
158166
name="Monitoring-Router-Process",
159167
daemon=True,

parsl/monitoring/router.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def __init__(self,
3232
monitoring_hub_address: str = "127.0.0.1",
3333
logdir: str = ".",
3434
logging_level: int = logging.INFO,
35-
atexit_timeout: int = 3, # in seconds
35+
atexit_timeout: float = 3, # in seconds
3636
resource_msgs: mpq.Queue,
3737
exit_event: Event,
3838
):
@@ -52,7 +52,9 @@ def __init__(self,
5252
logging_level : int
5353
Logging level as defined in the logging module. Default: logging.INFO
5454
atexit_timeout : float, optional
55-
The amount of time in seconds to terminate the hub without receiving any messages, after the last dfk workflow message is received.
55+
The amount of time in seconds to wait for more UDP messages at shutdown, after the last DFK
56+
workflow message is received.
57+
5658
resource_msgs : multiprocessing.Queue
5759
A multiprocessing queue to receive messages to be routed onwards to the database process
5860
@@ -190,6 +192,8 @@ def router_starter(*,
190192
udp_port: Optional[int],
191193
zmq_port_range: Tuple[int, int],
192194

195+
udp_atexit_timeout: float,
196+
193197
logdir: str,
194198
logging_level: int) -> None:
195199
setproctitle("parsl: monitoring router")
@@ -200,7 +204,8 @@ def router_starter(*,
200204
logdir=logdir,
201205
logging_level=logging_level,
202206
resource_msgs=resource_msgs,
203-
exit_event=exit_event)
207+
exit_event=exit_event,
208+
atexit_timeout=udp_atexit_timeout)
204209
except Exception as e:
205210
logger.error("MonitoringRouter construction failed.", exc_info=True)
206211
comm_q.put(f"Monitoring router construction failed: {e}")

parsl/tests/test_monitoring/test_stdouterr.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ def fresh_config(run_dir):
3838
monitoring=MonitoringHub(
3939
hub_address="localhost",
4040
hub_port=55055,
41+
udp_atexit_timeout=0
4142
)
4243
)
4344

0 commit comments

Comments
 (0)