Skip to content

Commit

Permalink
Format with ruff
Browse files Browse the repository at this point in the history
  • Loading branch information
jopemachine committed Mar 27, 2024
1 parent 3819025 commit a2dec4f
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 22 deletions.
8 changes: 3 additions & 5 deletions src/ai/backend/common/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -1190,11 +1190,9 @@ def from_json(cls, obj: Mapping[str, Any]) -> RoundRobinState:

@classmethod
def as_trafaret(cls) -> t.Trafaret:
return t.Dict(
{
t.Key("next_index"): t.Int,
}
)
return t.Dict({
t.Key("next_index"): t.Int,
})


# This is only used when AgentSelectionStrategy is ROUNDROBIN.
Expand Down
24 changes: 11 additions & 13 deletions src/ai/backend/manager/models/scaling_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,19 +95,17 @@ def from_json(cls, obj: Mapping[str, Any]) -> ScalingGroupOpts:

@classmethod
def as_trafaret(cls) -> t.Trafaret:
return t.Dict(
{
t.Key("allowed_session_types", default=["interactive", "batch"]): t.List(
tx.Enum(SessionTypes), min_length=1
),
t.Key("pending_timeout", default=0): tx.TimeDuration(allow_negative=False),
# Each scheduler impl refers an additional "config" key.
t.Key("config", default={}): t.Mapping(t.String, t.Any),
t.Key(
"agent_selection_strategy", default=AgentSelectionStrategy.DISPERSED
): tx.Enum(AgentSelectionStrategy),
}
).allow_extra("*")
return t.Dict({
t.Key("allowed_session_types", default=["interactive", "batch"]): t.List(
tx.Enum(SessionTypes), min_length=1
),
t.Key("pending_timeout", default=0): tx.TimeDuration(allow_negative=False),
# Each scheduler impl refers an additional "config" key.
t.Key("config", default={}): t.Mapping(t.String, t.Any),
t.Key("agent_selection_strategy", default=AgentSelectionStrategy.DISPERSED): tx.Enum(
AgentSelectionStrategy
),
}).allow_extra("*")


scaling_groups = sa.Table(
Expand Down
8 changes: 4 additions & 4 deletions src/ai/backend/manager/scheduler/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -512,10 +512,10 @@ async def select_agent(
sgroup_name = roundrobin_context.sgroup_name
requested_architecture = get_requested_architecture(pending_session_or_kernel)

rr_state: RoundRobinState | None = (
await sched_ctx.registry.shared_config.get_roundrobin_state(
sgroup_name, requested_architecture
)
rr_state: (
RoundRobinState | None
) = await sched_ctx.registry.shared_config.get_roundrobin_state(
sgroup_name, requested_architecture
)

if rr_state is None:
Expand Down

0 comments on commit a2dec4f

Please sign in to comment.