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

Regularise monitoring RESOURCE_INFO messages #2117

Merged
merged 2 commits into from
Sep 27, 2021
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
6 changes: 4 additions & 2 deletions parsl/monitoring/db_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -541,8 +541,10 @@ def _migrate_logs_to_internal(self, logs_queue: queue.Queue, queue_tag: str, kil
"_migrate_logs_to_internal can only migrate WORKFLOW_,TASK_INFO message from priority queue, got x[0] == {}".format(x[0])
self.pending_priority_queue.put(cast(Any, x))
elif queue_tag == 'resource':
assert len(x) == 3
self.pending_resource_queue.put(x[-1])
assert x[0] == MessageType.RESOURCE_INFO, "_migrate_logs_to_internal can only migrate RESOURCE_INFO message from resource queue"
body = x[1]
assert len(body) == 3
self.pending_resource_queue.put(body[-1])
elif queue_tag == 'node':
assert len(x) == 2, "expected message tuple to have exactly two elements"
assert x[0] == MessageType.NODE_INFO, "_migrate_logs_to_internal can only migrate NODE_INFO messages from node queue"
Expand Down
3 changes: 3 additions & 0 deletions parsl/monitoring/message_type.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ class MessageType(Enum):
# Reports any task related info such as launch, completion etc.
TASK_INFO = 0

# Reports of resource utilization on a per-task basis
RESOURCE_INFO = 1

# Top level workflow information
WORKFLOW_INFO = 2

Expand Down
8 changes: 4 additions & 4 deletions parsl/monitoring/monitoring.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ def start(self, run_id: str) -> int:
comm_q = SizedQueue(maxsize=10) # type: Queue[Union[Tuple[int, int], str]]
self.exception_q = SizedQueue(maxsize=10) # type: Queue[Tuple[str, str]]
self.priority_msgs = SizedQueue() # type: Queue[Tuple[Any, int]]
self.resource_msgs = SizedQueue() # type: Queue[Tuple[Dict[str, Any], Any]]
self.resource_msgs = SizedQueue() # type: Queue[Tuple[Tuple[MessageType, Dict[str, Any]], Any]]
self.node_msgs = SizedQueue() # type: Queue[Tuple[Tuple[MessageType, Dict[str, Any]], int]]
self.block_msgs = SizedQueue() # type: Queue[Tuple[Tuple[MessageType, Dict[str, Any]], Any]]

Expand Down Expand Up @@ -442,14 +442,14 @@ def start(self,
priority_msgs: "queue.Queue[Tuple[Tuple[MessageType, Dict[str, Any]], int]]",
node_msgs: "queue.Queue[Tuple[Tuple[MessageType, Dict[str, Any]], int]]",
block_msgs: "queue.Queue[Tuple[Tuple[MessageType, Dict[str, Any]], int]]",
resource_msgs: "queue.Queue[Tuple[Dict[str, Any], Any]]") -> None:
resource_msgs: "queue.Queue[Tuple[Tuple[MessageType, Dict[str, Any]], Any]]") -> None:
try:
while True:
try:
data, addr = self.sock.recvfrom(2048)
msg = pickle.loads(data)
self.logger.debug("Got UDP Message from {}: {}".format(addr, msg))
resource_msgs.put((msg, addr))
resource_msgs.put(((MessageType.RESOURCE_INFO, msg), addr))
except socket.timeout:
pass

Expand Down Expand Up @@ -517,7 +517,7 @@ def router_starter(comm_q: "queue.Queue[Union[Tuple[int, int], str]]",
priority_msgs: "queue.Queue[Tuple[Tuple[MessageType, Dict[str, Any]], int]]",
node_msgs: "queue.Queue[Tuple[Tuple[MessageType, Dict[str, Any]], int]]",
block_msgs: "queue.Queue[Tuple[Tuple[MessageType, Dict[str, Any]], int]]",
resource_msgs: "queue.Queue[Tuple[Dict[str, Any], str]]",
resource_msgs: "queue.Queue[Tuple[Tuple[MessageType, Dict[str, Any]], str]]",

hub_address: str,
hub_port: Optional[int],
Expand Down