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

Make monitoring radio send() signature consistent with radio.send #3672

Merged
merged 1 commit into from
Nov 1, 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
10 changes: 5 additions & 5 deletions parsl/dataflow/dflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,8 @@ def __init__(self, config: Config) -> None:
}

if self.monitoring:
self.monitoring.send(MessageType.WORKFLOW_INFO,
workflow_info)
self.monitoring.send((MessageType.WORKFLOW_INFO,
workflow_info))

if config.checkpoint_files is not None:
checkpoints = self.load_checkpoints(config.checkpoint_files)
Expand Down Expand Up @@ -238,7 +238,7 @@ def __exit__(self, exc_type, exc_value, traceback) -> None:
def _send_task_log_info(self, task_record: TaskRecord) -> None:
if self.monitoring:
task_log_info = self._create_task_log_info(task_record)
self.monitoring.send(MessageType.TASK_INFO, task_log_info)
self.monitoring.send((MessageType.TASK_INFO, task_log_info))

def _create_task_log_info(self, task_record: TaskRecord) -> Dict[str, Any]:
"""
Expand Down Expand Up @@ -1295,12 +1295,12 @@ def cleanup(self) -> None:

if self.monitoring:
logger.info("Sending final monitoring message")
self.monitoring.send(MessageType.WORKFLOW_INFO,
self.monitoring.send((MessageType.WORKFLOW_INFO,
{'tasks_failed_count': self.task_state_counts[States.failed],
'tasks_completed_count': self.task_state_counts[States.exec_done],
"time_began": self.time_began,
'time_completed': self.time_completed,
'run_id': self.run_id, 'rundir': self.run_dir})
'run_id': self.run_id, 'rundir': self.run_dir}))

logger.info("Terminating monitoring")
self.monitoring.close()
Expand Down
10 changes: 4 additions & 6 deletions parsl/monitoring/monitoring.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,12 @@
import time
from multiprocessing import Event, Process
from multiprocessing.queues import Queue
from typing import TYPE_CHECKING, Any, Literal, Optional, Tuple, Union, cast
from typing import TYPE_CHECKING, Literal, Optional, Tuple, Union, cast

import typeguard

from parsl.log_utils import set_file_logger
from parsl.monitoring.errors import MonitoringHubStartError
from parsl.monitoring.message_type import MessageType
from parsl.monitoring.radios import MultiprocessingQueueRadioSender
from parsl.monitoring.router import router_starter
from parsl.monitoring.types import TaggedMonitoringMessage
Expand Down Expand Up @@ -202,10 +201,9 @@ def start(self, dfk_run_dir: str, config_run_dir: Union[str, os.PathLike]) -> No

self.hub_zmq_port = zmq_port

# TODO: tighten the Any message format
def send(self, mtype: MessageType, message: Any) -> None:
logger.debug("Sending message type {}".format(mtype))
self.radio.send((mtype, message))
def send(self, message: TaggedMonitoringMessage) -> None:
logger.debug("Sending message type {}".format(message[0]))
self.radio.send(message)
Comment on lines +204 to +206
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While here, "might as well" update the log.debug() call.


def close(self) -> None:
logger.info("Terminating Monitoring Hub")
Expand Down
Loading