Hi TimelyPenguin76 , I used api_client.tasks.create
and It works, thank you!
Editing the cloned task ?
` script = template_task.script
This will override the commit id, you can also override the branch, repository if you like -
script.version_num = COMMIT_ID
t = api_client.tasks.edit(task=t.id,
script=script) `
Hi TimelyPenguin76 , I tried your approach and it works, thank you! However it's a bit different to what I was trying to do: instead of cloning an existing task I'd like to specify the repository and a specific commit tag to use as it is done in Task.create. If this is possible with the API client it would be perfect
Hi LovelyHamster1 ,
I had similar issue and used the APIClient
( from clearml.backend_api.session.client import APIClient
).
I cloned a template_task and did some changes, and enqueue it after, here is the code:
` from clearml.backend_api.session.client import APIClient
api_client = APIClient()
BASE_TASK_ID = "MY TASK ID"
Task.get_task
template_task = api_client.tasks.get_by_id(BASE_TASK_ID)
Task.clone
cloned_task = api_client.tasks.clone(task=template_task.id,
new_task_name=f"{template_task.name} from AWS lambda",
new_task_tags=template_task.tags,
new_task_comment=template_task.comment,
new_task_parent=template_task.id if not template_task.parent else template_task.parent,
new_task_project=template_task.project,
)
Do your changes here
.
.
.
Task.enqueue
all_queues = api_client.queues.get_all(name="default", only_fields=["id"])
queue_id = all_queues[0].id
api_client.tasks.enqueue(task=cloned_task.id, queue=queue_id) `I worked with this https://allegro.ai/clearml/docs/rst/references/clearml_api_ref/index.html
I also added a layer with ClearML