Skip to content

Commit

Permalink
More explicit typing for JobMetricFormatter implementations
Browse files Browse the repository at this point in the history
  • Loading branch information
dannon committed Feb 21, 2024
1 parent 404001c commit 8bab510
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
5 changes: 3 additions & 2 deletions lib/galaxy/job_metrics/instrumenters/hostname.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""The module describes the ``hostname`` job metrics plugin."""

import logging
from typing import Any

from . import InstrumentPlugin
from .. import formatting
Expand All @@ -9,8 +10,8 @@


class HostnameFormatter(formatting.JobMetricFormatter):
def format(self, key, value):
return key, value
def format(self, key: str, value: Any):
return formatting.FormattedMetric(key, value)


class HostnamePlugin(InstrumentPlugin):
Expand Down
5 changes: 3 additions & 2 deletions lib/galaxy/job_metrics/instrumenters/meminfo.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""The module describes the ``meminfo`` job metrics plugin."""

import re
from typing import Any

from galaxy import util
from . import InstrumentPlugin
Expand All @@ -14,9 +15,9 @@


class MemInfoFormatter(formatting.JobMetricFormatter):
def format(self, key, value):
def format(self, key: str, value: Any):
title = MEMINFO_TITLES.get(key, key)
return title, util.nice_size(value * 1000) # kB = *1000, KB = *1024 - wikipedia
return formatting.FormattedMetric(title, util.nice_size(value * 1000)) # kB = *1000, KB = *1024 - wikipedia


class MemInfoPlugin(InstrumentPlugin):
Expand Down

0 comments on commit 8bab510

Please sign in to comment.