Skip to content

Commit 79952b0

Browse files
committed
Change list_jobs() limit to 100
instead of fake "unlimited" which was capped in practice anyway ref: #677
1 parent 9e0d5c6 commit 79952b0

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1515
### Changed
1616

1717
- Eliminate deprecated `utcnow` usage patterns. Introduce `Rfc3339.now_utc()` method (as replacement for deprecated `utcnow()` method) to simplify finding deprecated `utcnow` usage in user code. ([#760](https://github.com/Open-EO/openeo-python-client/issues/760))
18+
- `Connection.list_jobs()`: change default `limit` to 100 (instead of fake "unlimited" which was arbitrarily capped in practice anyway) ([#677](https://github.com/Open-EO/openeo-python-client/issues/677))
1819

1920
### Removed
2021

openeo/rest/connection.py

+7-2
Original file line numberDiff line numberDiff line change
@@ -889,11 +889,13 @@ def describe_process(self, id: str, namespace: Optional[str] = None) -> dict:
889889

890890
raise OpenEoClientException("Process does not exist.")
891891

892-
def list_jobs(self, limit: Union[int, None] = None) -> JobListingResponse:
892+
def list_jobs(self, limit: Union[int, None] = 100) -> JobListingResponse:
893893
"""
894894
Lists (batch) jobs metadata of the authenticated user.
895895
896-
:param limit: maximum number of jobs to return. Setting this limit enables pagination.
896+
:param limit: maximum number of jobs to return (with pagination).
897+
Can be set to ``None`` to disable pagination,
898+
but note that the backend might still silently cap the listing in practice.
897899
898900
:return: job_list: Dict of all jobs of the user.
899901
@@ -903,6 +905,9 @@ def list_jobs(self, limit: Union[int, None] = None) -> JobListingResponse:
903905
.. versionchanged:: 0.38.0
904906
Returns a :py:class:`~openeo.rest.models.general.JobListingResponse` object
905907
instead of simple ``List[dict]``.
908+
909+
.. versionchanged:: 0.41.0
910+
Change default value of ``limit`` to 100 (instead of unlimited).
906911
"""
907912
# TODO: Parse the result so that Job classes returned?
908913
# TODO: when pagination is enabled: how to expose link to next page?

tests/rest/test_job.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -812,7 +812,8 @@ def download_tiff(request, context):
812812
@pytest.mark.parametrize(
813813
["list_jobs_kwargs", "expected_qs"],
814814
[
815-
({}, {}),
815+
({}, {"limit": ["100"]}),
816+
({"limit": None}, {}),
816817
({"limit": 123}, {"limit": ["123"]}),
817818
],
818819
)

0 commit comments

Comments
 (0)