mirror of
https://github.com/clearml/clearml
synced 2025-03-03 18:52:12 +00:00
Fix always order by created time
This commit is contained in:
parent
289063e345
commit
13dd130c7d
@ -518,7 +518,7 @@ class Task(IdObjectBase, AccessMixin, SetupUploadMixin):
|
|||||||
page=0,
|
page=0,
|
||||||
page_size=10,
|
page_size=10,
|
||||||
order_by='-created',
|
order_by='-created',
|
||||||
only_fields=['id']
|
only_fields=['id', 'created']
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
model = get_single_result(entity='model', query=model_name, results=res.response.models, log=self.log)
|
model = get_single_result(entity='model', query=model_name, results=res.response.models, log=self.log)
|
||||||
|
@ -41,9 +41,11 @@ def get_single_result(entity, query, results, log=None, show_results=10, raise_o
|
|||||||
if sort_by_date:
|
if sort_by_date:
|
||||||
# sort results based on timestamp and return the newest one
|
# sort results based on timestamp and return the newest one
|
||||||
if hasattr(results[0], 'last_update'):
|
if hasattr(results[0], 'last_update'):
|
||||||
results = sorted(results, key=lambda x: int(x.last_update.strftime('%s')), reverse=True)
|
results = sorted(results, key=lambda x: int(x.last_update.strftime('%s')
|
||||||
|
if x.last_update else 0), reverse=True)
|
||||||
elif hasattr(results[0], 'created'):
|
elif hasattr(results[0], 'created'):
|
||||||
results = sorted(results, key=lambda x: int(x.created.strftime('%s')), reverse=True)
|
results = sorted(results, key=lambda x: int(x.created.strftime('%s')
|
||||||
|
if x.created else 0), reverse=True)
|
||||||
|
|
||||||
for obj in (o if isinstance(o, dict) else o.to_dict() for o in results[:show_results]):
|
for obj in (o if isinstance(o, dict) else o.to_dict() for o in results[:show_results]):
|
||||||
log.warn('Found {entity} `{obj[name]}` (id={obj[id]})'.format(**locals()))
|
log.warn('Found {entity} `{obj[name]}` (id={obj[id]})'.format(**locals()))
|
||||||
|
@ -381,7 +381,7 @@ class InputModel(BaseModel):
|
|||||||
if Session.check_min_api_version('2.3') else {'tags': ["-" + ARCHIVED_TAG]}
|
if Session.check_min_api_version('2.3') else {'tags': ["-" + ARCHIVED_TAG]}
|
||||||
result = _Model._get_default_session().send(models.GetAllRequest(
|
result = _Model._get_default_session().send(models.GetAllRequest(
|
||||||
uri=[weights_url],
|
uri=[weights_url],
|
||||||
only_fields=["id", "name"],
|
only_fields=["id", "name", "created"],
|
||||||
**extra
|
**extra
|
||||||
))
|
))
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user