Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion src/dstack/_internal/core/compatibility/runs.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,16 @@
from dstack._internal.core.models.common import IncludeExcludeDictType, IncludeExcludeSetType
from dstack._internal.core.models.configurations import ServiceConfiguration
from dstack._internal.core.models.runs import ApplyRunPlanInput, JobSpec, JobSubmission, RunSpec
from dstack._internal.server.schemas.runs import GetRunPlanRequest
from dstack._internal.server.schemas.runs import GetRunPlanRequest, ListRunsRequest


def get_list_runs_excludes(list_runs_request: ListRunsRequest) -> IncludeExcludeSetType:
excludes = set()
if list_runs_request.include_jobs:
excludes.add("include_jobs")
if list_runs_request.job_submissions_limit is None:
excludes.add("job_submissions_limit")
return excludes


def get_apply_plan_excludes(plan: ApplyRunPlanInput) -> Optional[IncludeExcludeDictType]:
Expand Down
2 changes: 1 addition & 1 deletion src/dstack/api/_public/runs.py
Original file line number Diff line number Diff line change
Expand Up @@ -748,7 +748,7 @@ def list(self, all: bool = False, limit: Optional[int] = None) -> List[Run]:
repo_id=None,
only_active=only_active,
limit=limit or 100,
job_submissions_limit=1, # no need to return more than 1 submission per job
# TODO: Pass job_submissions_limit=1 in 0.20
)
if only_active and len(runs) == 0:
runs = self._api_client.runs.list(
Expand Down
10 changes: 8 additions & 2 deletions src/dstack/api/server/_runs.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@

from pydantic import parse_obj_as

from dstack._internal.core.compatibility.runs import get_apply_plan_excludes, get_get_plan_excludes
from dstack._internal.core.compatibility.runs import (
get_apply_plan_excludes,
get_get_plan_excludes,
get_list_runs_excludes,
)
from dstack._internal.core.models.runs import (
ApplyRunPlanInput,
Run,
Expand Down Expand Up @@ -48,7 +52,9 @@ def list(
limit=limit,
ascending=ascending,
)
resp = self._request("/api/runs/list", body=body.json())
resp = self._request(
"/api/runs/list", body=body.json(exclude=get_list_runs_excludes(body))
)
return parse_obj_as(List[Run.__response__], resp.json())

def get(self, project_name: str, run_name: str) -> Run:
Expand Down
Loading