AgitatedDove14 does this release include the decorator for function tasks? 🙂
Hmm should be pushed later today, meanwhile:
` from clearml import Task
from clearml.automation.trigger import TriggerScheduler
def func(*args, **kwargs):
print('test', args, kwargs)
if name == 'main':
s = TriggerScheduler(pooling_frequency_minutes=1.0)
s.add_model_trigger(
name='trigger 1', schedule_function=func,
trigger_project='examples', trigger_on_tags=['deploy']
)
s.add_model_trigger(
name='trigger 2',
schedule_task_id='3f7458549e814591b003a87f63c333c6',
schedule_queue='moshik',
trigger_project='examples', trigger_on_tags=['deploy']
)
s.add_dataset_trigger(
name='trigger 3', schedule_function=func,
trigger_project='datasets', trigger_on_tags=['deploy']
)
s.add_task_trigger(
name='trigger 4', schedule_function=func,
trigger_project='examples',
trigger_on_metric='epoch_accuracy', trigger_on_variant='epoch_accuracy',
trigger_on_sign='max', trigger_on_threshold=0.99
)
s.start() `
` from clearml import Task
from clearml.automation.scheduler import TaskScheduler
def func():
print('test')
if name == 'main':
s = TaskScheduler()
s.add_task(name='example job', schedule_function=func, minute=10)
s.start() `
AgitatedDove14 awesome, is there an example somewhere by any chance?
Hi JealousParrot68
no need for decorators, you can just pass the function to schedule_function=<function goes here>
🙂
See scheduler here
https://github.com/allegroai/clearml/blob/8708967a5ef4d8529a1a5ea417672e3ebbb258d7/clearml/automation/scheduler.py#L485
And triggers here:
https://github.com/allegroai/clearml/blob/8708967a5ef4d8529a1a5ea417672e3ebbb258d7/clearml/automation/trigger.py#L193
https://github.com/allegroai/clearml/blob/8708967a5ef4d8529a1a5ea417672e3ebbb258d7/clearml/automation/trigger.py#L271
https://github.com/allegroai/clearml/blob/8708967a5ef4d8529a1a5ea417672e3ebbb258d7/clearml/automation/trigger.py#L350
The difference is whether you are only supplying a "minutes" or you are also passing hour/day etc.
See the examples:
Every 15 minutesadd_task(task_id='1235', queue='default', minute=15)
Every hour on minute 20 of the hour (i.e. 00:20, 01:20 ...)add_task(task_id='1235', queue='default', hour=1, minute=20)
Just wanted to highlight that you can now schedule your tasks for later execution!!!!
Also the docstring is a bit inconclusive:Launch every 15 minutes add_task(task_id='1235', queue='default', minute=15) Launch every 1 hour add_task(task_id='1235', queue='default', hour=1)
but then later::param minute: If specified launch Task at a specific minute of the day (Valid values 0-60) :param hour: If specified launch Task at a specific hour (24h) of the day (Valid values 0-24)
The first seems to imply that 15 will launch every 15 minutes (4 times an hour) and the second implies putting 15 would always start on minute 15 (once per hour) 🤔