mirror of
https://github.com/clearml/clearml-server
synced 2025-02-07 13:33:42 +00:00
Improve utilities
This commit is contained in:
parent
e6dc4b7557
commit
81e3fc6577
@ -1,7 +1,7 @@
|
|||||||
import threading
|
import threading
|
||||||
from concurrent.futures import ThreadPoolExecutor
|
from concurrent.futures import ThreadPoolExecutor
|
||||||
from itertools import groupby, chain
|
from itertools import groupby, chain
|
||||||
from typing import Sequence, Dict, Callable, Tuple, Any, Type
|
from typing import Sequence, Dict, Callable
|
||||||
|
|
||||||
from apiserver.apierrors import errors
|
from apiserver.apierrors import errors
|
||||||
from apiserver.database.props import PropsMixin
|
from apiserver.database.props import PropsMixin
|
||||||
@ -49,9 +49,6 @@ class ProjectionHelper(object):
|
|||||||
self._ref_projection = None
|
self._ref_projection = None
|
||||||
self._proxy_manager = _ProxyManager()
|
self._proxy_manager = _ProxyManager()
|
||||||
|
|
||||||
# Cached dpath paths for each of the result documents
|
|
||||||
self._cached_results_paths: Dict[int, Sequence[Tuple[Any, Type]]] = {}
|
|
||||||
|
|
||||||
self._parse_projection(projection)
|
self._parse_projection(projection)
|
||||||
|
|
||||||
def _collect_projection_fields(self, doc_cls, projection):
|
def _collect_projection_fields(self, doc_cls, projection):
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import hashlib
|
import hashlib
|
||||||
from inspect import ismethod, getmembers
|
from inspect import ismethod, getmembers
|
||||||
from typing import Sequence, Tuple, Set, Optional, Callable, Any
|
from typing import Sequence, Tuple, Set, Optional, Callable, Any, Mapping
|
||||||
from uuid import uuid4
|
from uuid import uuid4
|
||||||
|
|
||||||
from mongoengine import EmbeddedDocumentField, ListField, Document, Q
|
from mongoengine import EmbeddedDocumentField, ListField, Document, Q
|
||||||
@ -203,18 +203,22 @@ def _names_set(*names: str) -> Set[str]:
|
|||||||
return set(names) | set(f"-{name}" for name in names)
|
return set(names) | set(f"-{name}" for name in names)
|
||||||
|
|
||||||
|
|
||||||
system_tag_names = {
|
_system_tag_names = {
|
||||||
"model": _names_set("active", "archived"),
|
"model": _names_set("active", "archived"),
|
||||||
"project": _names_set("archived", "public", "default"),
|
"project": _names_set("archived", "public", "default"),
|
||||||
"task": _names_set("active", "archived", "development"),
|
"task": _names_set("active", "archived", "development"),
|
||||||
"queue": _names_set("default"),
|
"queue": _names_set("default"),
|
||||||
}
|
}
|
||||||
|
|
||||||
system_tag_prefixes = {"task": _names_set("annotat")}
|
_system_tag_prefixes = {"task": _names_set("annotat")}
|
||||||
|
|
||||||
|
|
||||||
def partition_tags(
|
def partition_tags(
|
||||||
entity: str, tags: Sequence[str], system_tags: Optional[Sequence[str]] = ()
|
entity: str,
|
||||||
|
tags: Sequence[str],
|
||||||
|
system_tags: Optional[Sequence[str]] = (),
|
||||||
|
system_tag_names: Mapping = _system_tag_names,
|
||||||
|
system_tag_prefixes: Mapping = _system_tag_prefixes,
|
||||||
) -> Tuple[Sequence[str], Sequence[str]]:
|
) -> Tuple[Sequence[str], Sequence[str]]:
|
||||||
"""
|
"""
|
||||||
Partition the given tags sequence into system and user-defined tags
|
Partition the given tags sequence into system and user-defined tags
|
||||||
|
Loading…
Reference in New Issue
Block a user