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
Unanswered
Hi All. I'M Setting Up An Model Export Script That Will Export Trained Models For Edge Deployment. I Initially Thought About Setting It Up As A Trigger Scheduler, And To Have It Trigger On Tags On A Published Model, But As Time Goes By The Trigger Schedul


Just wanted to share a workaround for using a TriggerScheduler to execute a script using the latest commit of a given branch, without relying on cloning a Task. Don't know if it has been shown before in here 🙂

from clearml import Model, Task
from clearml.automation import TriggerScheduler

def trigger_model_func(model_id: str):
    model = Model(model_id)

    print(f"Triggered model export for model '{model.name}' ({model_id})")

    # NOTE: To execute from the branch of
    # task of the model uncomment the following lines:
    # task: Task = Task.get_task(model.task)
    # script_info = task.get_script()
    # branch = script_info["branch"]
    # repo = script_info["repository"]
    repo = "git@ssh.dev.azure.com:v3/org/project/repo"
    branch = "main"
    
    subtask: Task = Task.create(
        project_name="Model export",
        task_name=f"Export of {model.name}",
        task_type=Task.TaskTypes.service,
        repo=repo,
        branch=branch,
        commit=None, # important to get the latest commit
        add_task_init_call=True,
        working_directory=".",
        script="scripts/export_model.py",
        argparse_args=[("model-id", model_id)],
    )

    Task.enqueue(subtask, "services")
  

if __name__ == "__main__":
    trigger = TriggerScheduler(pooling_frequency_minutes=2)
  
    # Add trigger on model export tag
    trigger.add_model_trigger(
        name="Model Export Trigger",
        schedule_function=trigger_model_func,
        trigger_on_tags=["export"],
    )  

    # trigger.start()
    trigger.start_remotely(queue="services")
  
  
Posted 9 months ago
111 Views
0 Answers
9 months ago
9 months ago