Introduce job_submissions_limit for /api/runs/list #2883
Conversation
| if job_submissions_limit == 0: | ||
| job_submissions = [] |
There was a problem hiding this comment.
I think this will result in no jobs returned at all, since the jobs list is populated from the latest submission. I assume the expected behavior would be to return jobs, just without job submissions.
There was a problem hiding this comment.
I want to have some way to return no jobs at all since they may be unnecessary for list runs and expensive at the same time. Fixed job_submissions_limit: 0 and added another parameter include_jobs.
| include_job_submissions: bool = True, | ||
| job_submissions_limit: Optional[int] = None, |
There was a problem hiding this comment.
(nit) If you decide to address my previous comment, include_job_submissions=False and job_submissions_limit=0 will have the same effect. It looks like include_job_submissions is not used anywhere, so it can be dropped.
531c022 to
36f874b
Compare
|
@r4victor, > dstack ps
Server validation error:
{'detail': [{'loc': ['body', 'include_jobs'],
'msg': 'extra fields not permitted',
'type': 'value_error.extra'},
{'loc': ['body', 'job_submissions_limit'],
'msg': 'extra fields not permitted',
'type': 'value_error.extra'}]} |
|
Thanks, fixed: #2894 |
This PR introduces
job_submissions_limitparameter for /api/runs/list endpoint that allows returning less job_submission per job, reducing response sizes significantly and speeding up the API / server. The CLI/UI are updated to request job_submissions_limit: 1 when listing runs – no need for all the submission there.The only downside so far: status_message calculation requires all the job submissions to be returned, so it may not return "retrying" if fewer job submission requested. This will be fixed in a separate PR since status_message calculation requires a revision.
Update: also adds
include_jobsparameter to include no jobs at all (no job specs).job_submissions_limit: 0still returns job specs but without jobs submissions.Speedups should stack nicely with #2880.
"job_submissions_limit": null:"job_submissions_limit": 1:"include_jobs": false:Speedups will be more significant if there are lots of submission per job (retrying), in my benchmarks there are at most 2-3 submissions per job.