Skip to content

Commit

Permalink
Testing: Add type annotations to api/heartbeat; rucio#6588
Browse files Browse the repository at this point in the history
  • Loading branch information
rdimaio committed Apr 26, 2024
1 parent 2c389be commit 81e689b
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions lib/rucio/gateway/heartbeat.py
Expand Up @@ -12,19 +12,21 @@
# 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
from rucio.db.sqla.session import read_session, transactional_session
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.
Expand All @@ -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.
Expand Down

0 comments on commit 81e689b

Please sign in to comment.