From 81e689b944ee18f5df76e2e9e3f49a0c7a5801aa Mon Sep 17 00:00:00 2001 From: rdimaio Date: Thu, 18 Apr 2024 13:02:33 +0200 Subject: [PATCH] Testing: Add type annotations to api/heartbeat; #6588 --- lib/rucio/gateway/heartbeat.py | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/lib/rucio/gateway/heartbeat.py b/lib/rucio/gateway/heartbeat.py index c46846e3b3..6e2f53812a 100644 --- a/lib/rucio/gateway/heartbeat.py +++ b/lib/rucio/gateway/heartbeat.py @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -from typing import TYPE_CHECKING +from typing import TYPE_CHECKING, Optional from rucio.common import exception from rucio.core import heartbeat @@ -20,11 +20,13 @@ from rucio.gateway import permission if TYPE_CHECKING: + from threading import Thread + from sqlalchemy.orm import Session @read_session -def list_heartbeats(issuer=None, vo='def', *, session: "Session"): +def list_heartbeats(issuer: Optional[str] = None, vo: str = 'def', *, session: "Session") -> list["heartbeat.HeartbeatDict"]: """ Return a list of tuples of all heartbeats. @@ -41,7 +43,18 @@ def list_heartbeats(issuer=None, vo='def', *, session: "Session"): @transactional_session -def create_heartbeat(executable, hostname, pid, older_than, payload, thread=None, issuer=None, vo='def', *, session: "Session"): +def create_heartbeat( + executable: str, + hostname: str, + pid: int, + older_than: int, + payload: Optional[str], + thread: Optional["Thread"] = None, + issuer: Optional[str] = None, + vo: str = 'def', + *, + session: "Session" +) -> None: """ Creates a heartbeat. :param issuer: The issuer account.