mirror of
https://github.com/clearml/clearml
synced 2025-06-26 18:16:07 +00:00
Fix Dataset.get()
should ignore archived datasets by default
This commit is contained in:
parent
16c8a037cc
commit
3cb66650e8
@ -1528,6 +1528,7 @@ class Dataset(object):
|
|||||||
dataset_tags=None, # type: Optional[Sequence[str]]
|
dataset_tags=None, # type: Optional[Sequence[str]]
|
||||||
only_completed=False, # type: bool
|
only_completed=False, # type: bool
|
||||||
only_published=False, # type: bool
|
only_published=False, # type: bool
|
||||||
|
include_archived=False, # type: bool
|
||||||
auto_create=False, # type: bool
|
auto_create=False, # type: bool
|
||||||
writable_copy=False, # type: bool
|
writable_copy=False, # type: bool
|
||||||
dataset_version=None, # type: Optional[str]
|
dataset_version=None, # type: Optional[str]
|
||||||
@ -1549,6 +1550,7 @@ class Dataset(object):
|
|||||||
:param dataset_tags: Requested dataset tags (list of tag strings)
|
:param dataset_tags: Requested dataset tags (list of tag strings)
|
||||||
:param only_completed: Return only if the requested dataset is completed or published
|
:param only_completed: Return only if the requested dataset is completed or published
|
||||||
:param only_published: Return only if the requested dataset is published
|
:param only_published: Return only if the requested dataset is published
|
||||||
|
:param include_archived: Include archived tasks and datasets also
|
||||||
:param auto_create: Create a new dataset if it does not exist yet
|
:param auto_create: Create a new dataset if it does not exist yet
|
||||||
:param writable_copy: Get a newly created mutable dataset with the current one as its parent,
|
:param writable_copy: Get a newly created mutable dataset with the current one as its parent,
|
||||||
so new files can added to the instance.
|
so new files can added to the instance.
|
||||||
@ -1562,6 +1564,9 @@ class Dataset(object):
|
|||||||
|
|
||||||
:return: Dataset object
|
:return: Dataset object
|
||||||
"""
|
"""
|
||||||
|
system_tags = ["__$all", cls.__tag]
|
||||||
|
if not include_archived:
|
||||||
|
system_tags = ["__$all", cls.__tag, "__$not", "archived"]
|
||||||
if not any([dataset_id, dataset_project, dataset_name, dataset_tags]):
|
if not any([dataset_id, dataset_project, dataset_name, dataset_tags]):
|
||||||
raise ValueError("Dataset selection criteria not met. Didn't provide id/name/project/tags correctly.")
|
raise ValueError("Dataset selection criteria not met. Didn't provide id/name/project/tags correctly.")
|
||||||
current_task = Task.current_task()
|
current_task = Task.current_task()
|
||||||
@ -1644,7 +1649,7 @@ class Dataset(object):
|
|||||||
dataset_version=dataset_version,
|
dataset_version=dataset_version,
|
||||||
dataset_filter=dict(
|
dataset_filter=dict(
|
||||||
tags=dataset_tags,
|
tags=dataset_tags,
|
||||||
system_tags=[cls.__tag, "-archived"],
|
system_tags=system_tags,
|
||||||
type=[str(Task.TaskTypes.data_processing)],
|
type=[str(Task.TaskTypes.data_processing)],
|
||||||
status=["published"]
|
status=["published"]
|
||||||
if only_published
|
if only_published
|
||||||
|
Loading…
Reference in New Issue
Block a user