Skip to content

Commit

Permalink
fix: typos
Browse files Browse the repository at this point in the history
  • Loading branch information
jopemachine committed Dec 23, 2024
1 parent b1522d0 commit 2b58767
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 17 deletions.
6 changes: 3 additions & 3 deletions src/ai/backend/client/cli/session/lifecycle.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion src/ai/backend/client/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]:
Expand Down
4 changes: 2 additions & 2 deletions src/ai/backend/manager/models/gql_models/kernel.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/ai/backend/manager/models/gql_models/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/ai/backend/manager/models/kernel.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
ExtendedAsyncSAEngine,
JSONCoalesceExpr,
execute_with_retry,
get_lastest_timestamp_for_status,
get_latest_timestamp_for_status,
sql_append_dict_to_list,
)

Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/ai/backend/manager/models/resource_usage.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions src/ai/backend/manager/models/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)
Expand Down Expand Up @@ -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]:
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/ai/backend/manager/models/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]:
Expand All @@ -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()

Expand Down

0 comments on commit 2b58767

Please sign in to comment.