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
Hi, Guys Can I Run A Task In Task? I Have Task, If That Ended, It Will Start To Run Another Task Remotely. Thanks In Advance!

Hi, guys
can i run a task in task?
i have task, if that ended, it will start to run another task remotely.
Thanks in advance!

  
  
Posted 9 months ago
Votes Newest

Answers 6


Thanks for response.

from clearml import Task
from clearml.automation import TaskScheduler
from datetime import timedelta, datetime

def my_task():
    task = Task.init(...)
    # do somthinge
    print("do something")
    # sleep 10
    condition = True
    if condition:
        # i want to trigger run another task by 
        # set some config in task, but execute tomorrow/sometime
        # not directly run at the time.
        # here i use
        task_id = task.id 
        task.close()
        task_clone:Task = Task.get_task(task_id=task_id)
        
        # schedule running a task for tomorrow
        now = datetime.utcnow()
        schedule_time = now + timedelta(days=1, minutes=30)
        hour = schedule_time.hour
        minute = schedule_time.minute
        
        scheduler = TaskScheduler(
            sync_frequency_minutes=60,
            force_create_task_name='Scheduler Task',
            force_create_task_project='Automation/Controller',
        )
        
        # here i run my task
        scheduler.add_task(
            target_project=task_clone.project,
            queue='cpu-nomad-preprod',
            name=task_clone.name,
            schedule_task_id=task_clone.id,
            minute=minute,
            hour=hour,
            day=1,
            recurring=False,
            task_parameters ={
                "params/limit_per_day": params["limit_per_day"], # limit perday, before 15k
                "params/csv_url": params["csv_url"],
                "params/zoom_level": params["zoom_level"],
                "params/pond_type": params["pond_type"],
            },
            single_instance=True
        )
        pass
    print("task end")

i tried do that, but it seems cannot do. do you have another solutions?

  
  
Posted 9 months ago

Hi @<1523701260895653888:profile|QuaintJellyfish58> , if the first task ended, how would you be able to start another task from that code? This sounds like a pipeline 🙂

  
  
Posted 9 months ago

I would suggest talking a look at pipelines: None

  
  
Posted 9 months ago

sorry, but can clearml pipeline do this scenario?
image

  
  
Posted 9 months ago

You can pass results to the reporting task, and simply decide not to do anything there on a condition (no need for intermediate logic)

  
  
Posted 9 months ago

i see okay thanks

  
  
Posted 9 months ago