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

Correct and check types on monitoring router and database processes #3572

Merged
merged 5 commits into from
Aug 14, 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
22 changes: 13 additions & 9 deletions parsl/monitoring/db_manager.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
import datetime
import logging
import multiprocessing.queues as mpq
import os
import queue
import threading
import time
from typing import Any, Dict, List, Optional, Set, Tuple, TypeVar, cast

import typeguard

from parsl.dataflow.states import States
from parsl.errors import OptionalModuleMissing
from parsl.log_utils import set_file_logger
Expand Down Expand Up @@ -305,10 +308,10 @@ def __init__(self,
self.pending_resource_queue: queue.Queue[MonitoringMessage] = queue.Queue()

def start(self,
priority_queue: "queue.Queue[TaggedMonitoringMessage]",
node_queue: "queue.Queue[MonitoringMessage]",
block_queue: "queue.Queue[MonitoringMessage]",
resource_queue: "queue.Queue[MonitoringMessage]") -> None:
priority_queue: mpq.Queue,
node_queue: mpq.Queue,
block_queue: mpq.Queue,
resource_queue: mpq.Queue) -> None:

self._kill_event = threading.Event()
self._priority_queue_pull_thread = threading.Thread(target=self._migrate_logs_to_internal,
Expand Down Expand Up @@ -719,11 +722,12 @@ def close(self) -> None:


@wrap_with_logs(target="database_manager")
def dbm_starter(exception_q: "queue.Queue[Tuple[str, str]]",
priority_msgs: "queue.Queue[TaggedMonitoringMessage]",
node_msgs: "queue.Queue[MonitoringMessage]",
block_msgs: "queue.Queue[MonitoringMessage]",
resource_msgs: "queue.Queue[MonitoringMessage]",
@typeguard.typechecked
def dbm_starter(exception_q: mpq.Queue,
priority_msgs: mpq.Queue,
node_msgs: mpq.Queue,
block_msgs: mpq.Queue,
resource_msgs: mpq.Queue,
khk-globus marked this conversation as resolved.
Show resolved Hide resolved
db_url: str,
logdir: str,
logging_level: int) -> None:
Expand Down
26 changes: 14 additions & 12 deletions parsl/monitoring/router.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
from __future__ import annotations

import logging
import multiprocessing.queues as mpq
import os
import pickle
import queue
import socket
import threading
import time
from multiprocessing.synchronize import Event
from typing import Optional, Tuple, Union
from typing import Optional, Tuple

import typeguard
import zmq

from parsl.log_utils import set_file_logger
Expand All @@ -33,10 +34,10 @@ def __init__(self,
logdir: str = ".",
logging_level: int = logging.INFO,
atexit_timeout: int = 3, # in seconds
priority_msgs: "queue.Queue[AddressedMonitoringMessage]",
node_msgs: "queue.Queue[AddressedMonitoringMessage]",
block_msgs: "queue.Queue[AddressedMonitoringMessage]",
resource_msgs: "queue.Queue[AddressedMonitoringMessage]",
priority_msgs: mpq.Queue,
node_msgs: mpq.Queue,
block_msgs: mpq.Queue,
resource_msgs: mpq.Queue,
exit_event: Event,
):
""" Initializes a monitoring configuration class.
Expand Down Expand Up @@ -202,12 +203,13 @@ def start_zmq_listener(self) -> None:


@wrap_with_logs
def router_starter(comm_q: "queue.Queue[Union[Tuple[int, int], str]]",
exception_q: "queue.Queue[Tuple[str, str]]",
priority_msgs: "queue.Queue[AddressedMonitoringMessage]",
node_msgs: "queue.Queue[AddressedMonitoringMessage]",
block_msgs: "queue.Queue[AddressedMonitoringMessage]",
resource_msgs: "queue.Queue[AddressedMonitoringMessage]",
@typeguard.typechecked
def router_starter(comm_q: mpq.Queue,
exception_q: mpq.Queue,
priority_msgs: mpq.Queue,
node_msgs: mpq.Queue,
block_msgs: mpq.Queue,
resource_msgs: mpq.Queue,
exit_event: Event,

hub_address: str,
Expand Down
Loading