mirror of
https://github.com/clearml/clearml-server
synced 2025-03-09 21:51:54 +00:00
Fix numeric hyperparam values are not sorted lexicographically with descending sort order
This commit is contained in:
parent
4291ad682a
commit
5c5d9b6434
@ -754,7 +754,9 @@ class GetMixin(PropsMixin):
|
||||
@classmethod
|
||||
def _get_collation_override(cls, field: str) -> Optional[dict]:
|
||||
return first(
|
||||
v for k, v in cls._field_collation_overrides.items() if field.startswith(k)
|
||||
v
|
||||
for k, v in cls._field_collation_overrides.items()
|
||||
if field.startswith(k) or field.startswith(f"-{k}")
|
||||
)
|
||||
|
||||
@classmethod
|
||||
|
@ -298,6 +298,23 @@ class TestTasksHyperparams(TestService):
|
||||
).tasks[0]
|
||||
self.assertEqual(new_params_dict2, res.hyperparams)
|
||||
|
||||
def test_numeric_ordering(self):
|
||||
params = [
|
||||
dict(section="section1", name="param1", type="type1", value="1"),
|
||||
dict(section="section1", name="param1", type="type1", value="2"),
|
||||
dict(section="section1", name="param1", type="type1", value="11"),
|
||||
]
|
||||
tasks = [
|
||||
self.new_task(hyperparams=self._param_dict_from_list([p]), project=None)[0]
|
||||
for p in params
|
||||
]
|
||||
|
||||
res = self.api.tasks.get_all_ex(id=tasks, order_by=["hyperparams.section1.param1"]).tasks
|
||||
self.assertEqual([t.id for t in res], tasks)
|
||||
|
||||
res = self.api.tasks.get_all_ex(id=tasks, order_by=["-hyperparams.section1.param1"]).tasks
|
||||
self.assertEqual([t.id for t in res], list(reversed(tasks)))
|
||||
|
||||
def test_old_api(self):
|
||||
legacy_params = {"legacy.1": "val1", "TF_DEFINE/param2": "val2"}
|
||||
legacy_config = {"design": "hello"}
|
||||
|
Loading…
Reference in New Issue
Block a user