When connecting a nested dict the keys will be in the struct of period/end
and period/start
, so those are the keys you need to change, in additional to the section name, General
if name not given.
This should work for example in your example:
` cloned_task = Task.clone(source_task=template_task,
name=template_task.name+' for params', parent=template_task.id)
put back into the new cloned task
cloned_task.set_parameters({"General/period/start": "0000-05-01 00:00", "General/period/end": "0000-08-31 23:00"}) `
or the code from above too (going over the keys):
` from clearml import Task
template_task = Task.get_task(task_id="<Your template task id>")
cloned_task = Task.clone(source_task=template_task,
name=template_task.name+' for params', parent=template_task.id)
cloned_task_parameters = cloned_task.get_parameters()
override with random samples form grid
for k in cloned_task_parameters.keys():
cloned_task_parameters[k] = "2020-01-01 00:56"
put back into the new cloned task
cloned_task.set_parameters(cloned_task_parameters) `
Yes, when the parameters that are connected do not have nested dictionaries, everything works fine. The problem comes when I try to do something like this:
` from clearml import Task
task = Task.init(project_name="Examples", task_name="task with connected dict")
args = {}
args["period"] = {"start": "2020-01-01 00:00", "end": "2020-12-31 23:00"}
task.connect(args) `
and the clone task is like this:
` from clearml import Task
template_task = Task.get_task(task_id="<Your template task id>")
cloned_task = Task.clone(source_task=template_task,
name=template_task.name+' for params', parent=template_task.id)
cloned_task_parameters = cloned_task.get_parameters()
cloned_task_parameters["period"] = {"start": "2021-05-01 00:00", "end": "2021-08-31 23:00"}
put back into the new cloned task
cloned_task.set_parameters(cloned_task_parameters) `
can you try those? Do you have an example for the cloning code?
I just tried and everything works.
I run this for the template task:
` from clearml import Task
task = Task.init(project_name="Examples", task_name="task with connected dict")
period = {"start": "2020-01-01 00:00", "end": "2020-12-31 23:00"}
task.connect(period, name="period") `
and this for the clone one:
` from clearml import Task
template_task = Task.get_task(task_id="<Your template task id>")
cloned_task = Task.clone(source_task=template_task,
name=template_task.name+' for params', parent=template_task.id)
cloned_task_parameters = cloned_task.get_parameters()
override with random samples form grid
for k in cloned_task_parameters.keys():
cloned_task_parameters[k] = "2020-01-01 00:56"
put back into the new cloned task
cloned_task.set_parameters(cloned_task_parameters) `
I have only checked it from code.
Exactly, I have followed that same workflow shown in that example. Maybe it has something to do with the dictionary's mutability?
Hi GiganticTurtle0 ,
Does it happen when you change the parameters from the UI too? or only from code? same flow as in https://github.com/allegroai/clearml/blob/master/examples/automation/manual_random_param_search_example.py#L47 ?