mirror of
https://github.com/clearml/clearml-server
synced 2025-01-31 10:56:48 +00:00
Allow projection of more than 500 items
This commit is contained in:
parent
4c98b87554
commit
1e51e2e221
@ -3,10 +3,14 @@ from concurrent.futures import ThreadPoolExecutor
|
|||||||
from itertools import groupby, chain
|
from itertools import groupby, chain
|
||||||
from typing import Sequence, Dict, Callable
|
from typing import Sequence, Dict, Callable
|
||||||
|
|
||||||
|
from boltons import iterutils
|
||||||
|
|
||||||
from apiserver.apierrors import errors
|
from apiserver.apierrors import errors
|
||||||
|
from apiserver.config_repo import config
|
||||||
from apiserver.database.props import PropsMixin
|
from apiserver.database.props import PropsMixin
|
||||||
|
|
||||||
SEP = "."
|
SEP = "."
|
||||||
|
max_items_per_fetch = config.get("services._mongo.max_page_size", 500)
|
||||||
|
|
||||||
|
|
||||||
class _ReferenceProxy(dict):
|
class _ReferenceProxy(dict):
|
||||||
@ -278,8 +282,9 @@ class ProjectionHelper(object):
|
|||||||
doc_only = list(filter(None, data["only"]))
|
doc_only = list(filter(None, data["only"]))
|
||||||
doc_only = list({"id"} | set(doc_only)) if doc_only else None
|
doc_only = list({"id"} | set(doc_only)) if doc_only else None
|
||||||
|
|
||||||
|
for ids_chunk in iterutils.chunked_iter(ids, max_items_per_fetch):
|
||||||
for res in projection_func(
|
for res in projection_func(
|
||||||
doc_type=doc_type, projection=doc_only, ids=ids
|
doc_type=doc_type, projection=doc_only, ids=ids_chunk
|
||||||
):
|
):
|
||||||
self._proxy_manager.update(res)
|
self._proxy_manager.update(res)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user