Skip to content

Commit

Permalink
chore: handle None expiration_countdown (#342)
Browse files Browse the repository at this point in the history
  • Loading branch information
chamini2 authored Oct 22, 2024
1 parent c885032 commit 0007191
Show file tree
Hide file tree
Showing 5 changed files with 144 additions and 159 deletions.
2 changes: 1 addition & 1 deletion projects/fal/src/fal/cli/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ def _runners(args):
str(runner.in_flight_requests),
(
"N/A (active)"
if not runner.expiration_countdown
if runner.expiration_countdown is None
else f"{runner.expiration_countdown}s"
),
f"{runner.uptime} ({runner.uptime.total_seconds()}s)",
Expand Down
8 changes: 5 additions & 3 deletions projects/fal/src/fal/sdk.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from dataclasses import dataclass, field
from datetime import datetime, timedelta
from enum import Enum
from typing import Any, Callable, Generic, Iterator, Literal, TypeVar
from typing import Any, Callable, Generic, Iterator, Literal, Optional, TypeVar

import grpc
import isolate_proto
Expand Down Expand Up @@ -214,7 +214,7 @@ class AliasInfo:
class RunnerInfo:
runner_id: str
in_flight_requests: int
expiration_countdown: int
expiration_countdown: Optional[int]
uptime: timedelta


Expand Down Expand Up @@ -344,7 +344,9 @@ def _from_grpc_runner_info(message: isolate_proto.RunnerInfo) -> RunnerInfo:
return RunnerInfo(
runner_id=message.runner_id,
in_flight_requests=message.in_flight_requests,
expiration_countdown=message.expiration_countdown,
expiration_countdown=message.expiration_countdown
if message.HasField("expiration_countdown")
else None,
uptime=timedelta(seconds=message.uptime),
)

Expand Down
2 changes: 1 addition & 1 deletion projects/isolate_proto/src/isolate_proto/controller.proto
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,6 @@ message ListAliasRunnersResponse {
message RunnerInfo {
string runner_id = 1;
int32 in_flight_requests = 2;
int32 expiration_countdown = 3;
optional int32 expiration_countdown = 3;
float uptime = 4;
}
Loading

0 comments on commit 0007191

Please sign in to comment.