Examples: query, "exact match", wildcard*, wild?ard, wild*rd
Fuzzy search: cake~ (finds cakes, bake)
Term boost: "red velvet"^4, chocolate^2
Field grouping: tags:(+work -"fun-stuff")
Escaping: Escape characters +-&|!(){}[]^"~*?:\ with \, e.g. \+
Range search: properties.timestamp:[1587729413488 TO *] (inclusive), properties.title:{A TO Z}(excluding A and Z)
Combinations: chocolate AND vanilla, chocolate OR vanilla, (chocolate OR vanilla) NOT "vanilla pudding"
Field search: properties.title:"The Title" AND text
Answered
Hey Clearml Experts Does Anyone Working Example How Can Use The Sdk To Delete Tasks, Where Tasks I'Ds Will Come From Static List Of Id'S I'M Generating A Json File With List Of Tasks, Review Them Then I Want To Delete Them In Batch Something Similar To

Hey ClearML experts

does anyone working example how can use the sdk to delete tasks, where tasks i'ds will come from static list of id's
I'm generating a json file with list of tasks, review them then I want to delete them in batch

something similar to cleanup_service , but the difference is I want to delete action to use static list of ids
while the above pulls tasks using the sdk and delete them right away

looking for an option to pull tasks to a file > review them I'm not deleting anything I still need > then run a loop to delete using the sdk
suggestions?

  
  
Posted 2 months ago
Votes Newest

Answers 4


Hi @<1523701842515595264:profile|PleasantOwl46> , you can write a very simple script using Task.Delete - None
Also, you can do that via the API - None
None

  
  
Posted 2 months ago

thanks @<1523701070390366208:profile|CostlyOstrich36>
I've done this successfully using the API already
as for the sdk option - in which format should I provide the list of tasks/projects to the sdk?

for
only_fields=["id", "name","created","status_changed","status", "user"], :

output example

{'id': '02a3f5929cf246138994c9243a692219', 'name': 'docfm_v7_safe_32gpu80g_11Jan24_4w', 'created': datetime.datetime(2024, 1, 11, 9, 54, 33, 406000, tzinfo=tzutc()), 'status_changed': datetime.datetime(2024, 1, 11, 10, 33, 42, 951000, tzinfo=tzutc()), 'status': <TaskStatusEnum.stopped: 'stopped'>, 'user': 'a33e22b207c8aca5cbfddd5d94b9d8f2'}

what I did is in order to review it, and match project names, I convert it to:

    {
        "Task ID": "356a47d592f647a3aa187e2047443eb0",
        "Name": "docfm_v7_safe_32gpu80g_11Jan24_4w",
        "User": "a33e22b207c8aca5cbfddd5d94b9d8f2",
        "Project": "1c02916ceba84b15a1ecb6686d93a4d1",
        "Status": "stopped",
        "Created": "2024-01-11 10:34:34.190000+00:00",
        "Last Changed": "2024-01-11 15:45:39.677000+00:00"
    },
  
  
Posted 2 months ago

so I have large json, with list of task id's
which I want to delete in bulk

API is doable

how about the sdk? how do I provide a list of tasks id's to for deletion

from the cleanup example:

        for task in tasks:
            try:
                deleted_task = Task.get_task(task_id=task.id)
                deleted_task.delete(

how do I set tasks , while coming from known list of task id's

  
  
Posted 2 months ago

For the SDK you have to provide it one by one so you'd have to iterate over the list

  
  
Posted 2 months ago