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
yup correct. but the scheduler not created idk why. here my code and the log
from doctest import Example
from clearml.automation import TriggerScheduler, TaskScheduler
from clearml import Task
import json
def open_json(fp):
with open(fp, 'r') as f:
my_dictionary = json.load(f)
return my_dictionary
def trigger_task_func(task_id):
print("trigger running...")
try:
previous_task = Task.get_task(task_id=task_id)
print(previous_task.artifacts)
try:
fp = previous_task.artifacts['latest_condition'].get_local_copy()
params = open_json(fp)
last_index = params.get('last_index')
day_n = params.get('iteration')
print("Success Fetching", params)
except Exception as e:
print("Failed Fetching", e)
last_index = 100
day_n = 10
print("Create Scheduler New")
scheduler = TaskScheduler()
scheduler.add_task(
target_project='Playground/Boy',
name=f"Map Scanning Iteration-{day_n}",
queue='cpu-nomad-preprod-py311',
schedule_task_id=task_id,
minute=10, # runt after 10 minutes
recurring=False,
execute_immediately=False,
task_parameters={
"last_index": last_index,
"iteration": day_n
}
)
print("Starting Scheduler...")
scheduler.start_remotely("services-py311")
print("okay running", scheduler.get_scheduled_tasks())
except Exception as e:
print(f"Error occurred: {str(e)}")
if __name__ == '__main__':
# create the TriggerScheduler object (checking system state every minute)
trigger = TriggerScheduler(
pooling_frequency_minutes=1.0,
)
# Add trigger on Task performance
trigger.add_task_trigger(
name='Trigger Scanning Checkpoint',
schedule_function=trigger_task_func,
trigger_project='Playground/xxx',
trigger_on_tags=['scanning-completed'],
trigger_on_status=['completed'],
schedule_queue="services-py311"
)
# start the trigger daemon (locally/remotely)
# trigger.start()
trigger.start_remotely(queue="services-py311")
104 Views
0
Answers
9 months ago
9 months ago