|
45 | 45 | from parsl.jobs.job_status_poller import JobStatusPoller |
46 | 46 | from parsl.monitoring import MonitoringHub |
47 | 47 | from parsl.monitoring.message_type import MessageType |
| 48 | +from parsl.monitoring.radios.multiprocessing import MultiprocessingQueueRadioSender |
48 | 49 | from parsl.monitoring.remote import monitor_wrapper |
49 | 50 | from parsl.process_loggers import wrap_with_logs |
50 | 51 | from parsl.usage_tracking.usage import UsageTracker |
@@ -110,8 +111,11 @@ def __init__(self, config: Config) -> None: |
110 | 111 | self.monitoring: Optional[MonitoringHub] |
111 | 112 | self.monitoring = config.monitoring |
112 | 113 |
|
| 114 | + self.monitoring_radio = None |
| 115 | + |
113 | 116 | if self.monitoring: |
114 | 117 | self.monitoring.start(self.run_dir, self.config.run_dir) |
| 118 | + self.monitoring_radio = MultiprocessingQueueRadioSender(self.monitoring.resource_msgs) |
115 | 119 |
|
116 | 120 | self.time_began = datetime.datetime.now() |
117 | 121 | self.time_completed: Optional[datetime.datetime] = None |
@@ -156,9 +160,9 @@ def __init__(self, config: Config) -> None: |
156 | 160 | 'host': gethostname(), |
157 | 161 | } |
158 | 162 |
|
159 | | - if self.monitoring: |
160 | | - self.monitoring.send((MessageType.WORKFLOW_INFO, |
161 | | - workflow_info)) |
| 163 | + if self.monitoring_radio: |
| 164 | + self.monitoring_radio.send((MessageType.WORKFLOW_INFO, |
| 165 | + workflow_info)) |
162 | 166 |
|
163 | 167 | if config.checkpoint_files is not None: |
164 | 168 | checkpoint_files = config.checkpoint_files |
@@ -231,9 +235,9 @@ def __exit__(self, exc_type, exc_value, traceback) -> None: |
231 | 235 | raise InternalConsistencyError(f"Exit case for {mode} should be unreachable, validated by typeguard on Config()") |
232 | 236 |
|
233 | 237 | def _send_task_log_info(self, task_record: TaskRecord) -> None: |
234 | | - if self.monitoring: |
| 238 | + if self.monitoring_radio: |
235 | 239 | task_log_info = self._create_task_log_info(task_record) |
236 | | - self.monitoring.send((MessageType.TASK_INFO, task_log_info)) |
| 240 | + self.monitoring_radio.send((MessageType.TASK_INFO, task_log_info)) |
237 | 241 |
|
238 | 242 | def _create_task_log_info(self, task_record: TaskRecord) -> Dict[str, Any]: |
239 | 243 | """ |
@@ -1215,15 +1219,16 @@ def cleanup(self) -> None: |
1215 | 1219 | logger.info("Terminated executors") |
1216 | 1220 | self.time_completed = datetime.datetime.now() |
1217 | 1221 |
|
1218 | | - if self.monitoring: |
| 1222 | + if self.monitoring_radio: |
1219 | 1223 | logger.info("Sending final monitoring message") |
1220 | | - self.monitoring.send((MessageType.WORKFLOW_INFO, |
1221 | | - {'tasks_failed_count': self.task_state_counts[States.failed], |
1222 | | - 'tasks_completed_count': self.task_state_counts[States.exec_done], |
1223 | | - "time_began": self.time_began, |
1224 | | - 'time_completed': self.time_completed, |
1225 | | - 'run_id': self.run_id, 'rundir': self.run_dir})) |
| 1224 | + self.monitoring_radio.send((MessageType.WORKFLOW_INFO, |
| 1225 | + {'tasks_failed_count': self.task_state_counts[States.failed], |
| 1226 | + 'tasks_completed_count': self.task_state_counts[States.exec_done], |
| 1227 | + "time_began": self.time_began, |
| 1228 | + 'time_completed': self.time_completed, |
| 1229 | + 'run_id': self.run_id, 'rundir': self.run_dir})) |
1226 | 1230 |
|
| 1231 | + if self.monitoring: |
1227 | 1232 | logger.info("Terminating monitoring") |
1228 | 1233 | self.monitoring.close() |
1229 | 1234 | logger.info("Terminated monitoring") |
|
0 commit comments