From 2b58767938283466bd4e449a13eba39d25cd1798 Mon Sep 17 00:00:00 2001 From: jopemachine Date: Mon, 23 Dec 2024 00:59:55 +0000 Subject: [PATCH] fix: typos --- src/ai/backend/client/cli/session/lifecycle.py | 6 +++--- src/ai/backend/client/utils.py | 2 +- src/ai/backend/manager/models/gql_models/kernel.py | 4 ++-- src/ai/backend/manager/models/gql_models/session.py | 4 ++-- src/ai/backend/manager/models/kernel.py | 4 ++-- src/ai/backend/manager/models/resource_usage.py | 4 ++-- src/ai/backend/manager/models/session.py | 6 +++--- src/ai/backend/manager/models/utils.py | 4 ++-- 8 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/ai/backend/client/cli/session/lifecycle.py b/src/ai/backend/client/cli/session/lifecycle.py index eac1597f430..60cf8de203a 100644 --- a/src/ai/backend/client/cli/session/lifecycle.py +++ b/src/ai/backend/client/cli/session/lifecycle.py @@ -26,7 +26,7 @@ from ai.backend.cli.types import ExitCode, Undefined, undefined from ai.backend.client.cli.extensions import pass_ctx_obj from ai.backend.client.cli.types import CLIContext -from ai.backend.client.utils import get_lastest_timestamp_for_status +from ai.backend.client.utils import get_latest_timestamp_for_status from ai.backend.common.arch import DEFAULT_IMAGE_ARCH from ai.backend.common.types import ClusterMode, SessionId @@ -928,11 +928,11 @@ async def cmd_main() -> None: ) if ( - preparing := get_lastest_timestamp_for_status(status_history, "PREPARING") + preparing := get_latest_timestamp_for_status(status_history, "PREPARING") ) is None: elapsed = timedelta() elif ( - terminated := get_lastest_timestamp_for_status(status_history, "TERMINATED") + terminated := get_latest_timestamp_for_status(status_history, "TERMINATED") ) is None: elapsed = datetime.now(tzutc()) - preparing else: diff --git a/src/ai/backend/client/utils.py b/src/ai/backend/client/utils.py index da5dca43521..4f093839053 100644 --- a/src/ai/backend/client/utils.py +++ b/src/ai/backend/client/utils.py @@ -53,7 +53,7 @@ def readinto1(self, *args, **kwargs): self.tqdm.update(count) -def get_lastest_timestamp_for_status( +def get_latest_timestamp_for_status( status_history: list[dict[str, str]], status: str, ) -> Optional[datetime]: diff --git a/src/ai/backend/manager/models/gql_models/kernel.py b/src/ai/backend/manager/models/gql_models/kernel.py index 872fdeb4a27..8fb9ade2363 100644 --- a/src/ai/backend/manager/models/gql_models/kernel.py +++ b/src/ai/backend/manager/models/gql_models/kernel.py @@ -23,7 +23,7 @@ from ..gql_relay import AsyncNode, Connection from ..kernel import KernelRow, KernelStatus from ..user import UserRole -from ..utils import get_lastest_timestamp_for_status +from ..utils import get_latest_timestamp_for_status from .image import ImageNode if TYPE_CHECKING: @@ -116,7 +116,7 @@ def from_row(cls, ctx: GraphQueryContext, row: KernelRow) -> Self: else: hide_agents = ctx.local_config["manager"]["hide-agents"] - timestamp = get_lastest_timestamp_for_status( + timestamp = get_latest_timestamp_for_status( cast(list[dict[str, str]], row.status_history), KernelStatus.SCHEDULED ) scheduled_at = str(timestamp) if timestamp is not None else None diff --git a/src/ai/backend/manager/models/gql_models/session.py b/src/ai/backend/manager/models/gql_models/session.py index d0a8df13b4a..c01dad077de 100644 --- a/src/ai/backend/manager/models/gql_models/session.py +++ b/src/ai/backend/manager/models/gql_models/session.py @@ -56,7 +56,7 @@ get_permission_ctx, ) from ..user import UserRole -from ..utils import execute_with_txn_retry, get_lastest_timestamp_for_status +from ..utils import execute_with_txn_retry, get_latest_timestamp_for_status from .kernel import KernelConnection, KernelNode if TYPE_CHECKING: @@ -225,7 +225,7 @@ def from_row( permissions: Optional[Iterable[ComputeSessionPermission]] = None, ) -> Self: status_history = row.status_history or {} - timestamp = get_lastest_timestamp_for_status( + timestamp = get_latest_timestamp_for_status( cast(list[dict[str, str]], status_history), SessionStatus.SCHEDULED ) scheduled_at = str(timestamp) if timestamp is not None else None diff --git a/src/ai/backend/manager/models/kernel.py b/src/ai/backend/manager/models/kernel.py index 47d1ddb1935..721d59b243e 100644 --- a/src/ai/backend/manager/models/kernel.py +++ b/src/ai/backend/manager/models/kernel.py @@ -87,7 +87,7 @@ ExtendedAsyncSAEngine, JSONCoalesceExpr, execute_with_retry, - get_lastest_timestamp_for_status, + get_latest_timestamp_for_status, sql_append_dict_to_list, ) @@ -911,7 +911,7 @@ def parse_row(cls, ctx: GraphQueryContext, row: KernelRow) -> Mapping[str, Any]: else: hide_agents = ctx.local_config["manager"]["hide-agents"] status_history = cast(list[dict[str, str]], row.status_history) - scheduled_at = get_lastest_timestamp_for_status(status_history, KernelStatus.SCHEDULED) + scheduled_at = get_latest_timestamp_for_status(status_history, KernelStatus.SCHEDULED) return { # identity diff --git a/src/ai/backend/manager/models/resource_usage.py b/src/ai/backend/manager/models/resource_usage.py index 1a99a104d33..2f3c18cdb3f 100644 --- a/src/ai/backend/manager/models/resource_usage.py +++ b/src/ai/backend/manager/models/resource_usage.py @@ -23,7 +23,7 @@ from .kernel import LIVE_STATUS, RESOURCE_USAGE_KERNEL_STATUSES, KernelRow, KernelStatus from .session import SessionRow from .user import UserRow -from .utils import ExtendedAsyncSAEngine, get_lastest_timestamp_for_status +from .utils import ExtendedAsyncSAEngine, get_latest_timestamp_for_status __all__: Sequence[str] = ( "ResourceGroupUnit", @@ -513,7 +513,7 @@ async def _pipe_builder(r: Redis) -> RedisPipeline: result = [] for kern in kernels: - timestamp = get_lastest_timestamp_for_status( + timestamp = get_latest_timestamp_for_status( cast(list[dict[str, str]], kern.status_history), KernelStatus.SCHEDULED ) scheduled_at = str(timestamp) if timestamp is not None else None diff --git a/src/ai/backend/manager/models/session.py b/src/ai/backend/manager/models/session.py index e8ab6cfdecc..511f1cf92d6 100644 --- a/src/ai/backend/manager/models/session.py +++ b/src/ai/backend/manager/models/session.py @@ -113,7 +113,7 @@ agg_to_array, execute_with_retry, execute_with_txn_retry, - get_lastest_timestamp_for_status, + get_latest_timestamp_for_status, get_legacy_status_history, sql_append_dict_to_list, ) @@ -851,7 +851,7 @@ def main_kernel(self) -> KernelRow: @property def status_changed(self) -> Optional[datetime]: - return get_lastest_timestamp_for_status(self.status_history, self.status) + return get_latest_timestamp_for_status(self.status_history, self.status) @property def resource_opts(self) -> dict[str, Any]: @@ -1635,7 +1635,7 @@ def parse_row(cls, ctx: GraphQueryContext, row: Row) -> Mapping[str, Any]: full_name = getattr(row, "full_name") group_name = getattr(row, "group_name") row = row.SessionRow - scheduled_at = get_lastest_timestamp_for_status(row.status_history, SessionStatus.SCHEDULED) + scheduled_at = get_latest_timestamp_for_status(row.status_history, SessionStatus.SCHEDULED) return { # identity diff --git a/src/ai/backend/manager/models/utils.py b/src/ai/backend/manager/models/utils.py index bc108fd7af5..3ed3792f45e 100644 --- a/src/ai/backend/manager/models/utils.py +++ b/src/ai/backend/manager/models/utils.py @@ -564,7 +564,7 @@ async def vacuum_db( await conn.exec_driver_sql(vacuum_sql) -def get_lastest_timestamp_for_status( +def get_latest_timestamp_for_status( status_history_log: list[dict[str, str]], status: str, ) -> Optional[datetime]: @@ -588,7 +588,7 @@ def get_legacy_status_history(status_history_log: list[dict[str, str]]) -> dict[ result_dict = {} for status in statuses: - latest_time = get_lastest_timestamp_for_status(status_history_log, status) + latest_time = get_latest_timestamp_for_status(status_history_log, status) if latest_time: result_dict[status] = latest_time.isoformat()