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 All! When I Set A List As A Task Parameter And Later Try To Retrieve It, What I Get Is A String. Is This The Expected Behavior? I Have Prepared The Following Snippet So That You Can Reproduce It.

Hi all! When I set a list as a Task parameter and later try to retrieve it, what I get is a string. Is this the expected behavior? I have prepared the following snippet so that you can reproduce it.
` from clearml import Task

task = Task.init()
task.set_parameter("metrics", ["nmae", "bias", "r2"])

metrics_names = task.get_parameter("General/metrics")

print(metrics_names)
print(type(metrics_names)) `I was expecting to receive the same list that I connected as a parameter.

  
  
Posted 3 years ago
Votes Newest

Answers 10


eval

 built-in. wdyt?

eval is never recommended as basically you could do Args/float='os.system("rm ...")' 🙂
In theory type is stored on the hyper parameter (this is a relatively new feature the backend supports)
The casting though, is done based on the Original value type, which means Task.connect needs to be called with the original dict. Is there a specific reason for using get_parameters instead of task.connect ?

  
  
Posted 3 years ago

If I try to connect a dictionary of type dict[str, list] with task.connect , when retrieving this dictionary with task.get_parameter I get another dictionary dict[str, str] . Therefore, I see the same behavior using task.connect :/

  
  
Posted 3 years ago

Hi AgitatedDove14
Using task.get_parameters I get the parameters in a dictionary, but the values are still of type 'string'. The quickest solution I can think of is parsing with eval built-in. wdyt?

  
  
Posted 3 years ago

Sure, just by changing a few things from the previous example:
` from clearml import Task

task = Task.init()
task.connect({"metrics": ["nmae", "bias", "r2"]})

metrics_names = task.get_parameter("General/metrics")

print(metrics_names)
print(type(metrics_names)) `

  
  
Posted 3 years ago

Task.debug_simulate_remote_task simulates the Task being executed by the agent (basically same behaviour, only local). the argument it gets is the Task ID (string).
The to see how it works is to run the code once (no debug_simulate call), get the Task ID we created, then rerun with the debug_simulate_remote_task passing the previous Task.ID
Make sense ?

  
  
Posted 3 years ago

Thanks AgitatedDove14 ! Wow, I was definitely not expecting that behavior 🤣 I will check it out tomorrow. Just one more thing, what do you mean by "my_task_id_that_i_generated_before_here"?

  
  
Posted 3 years ago

Hm GiganticTurtle0 let me check quickly it

  
  
Posted 3 years ago

If I try to connect a dictionary of type 

dict[str, list]

 with 

task.connect

, when retrieving this dictionary with

Wait, this should work out of the box, do you have any specific example?

  
  
Posted 3 years ago

Okay I think I found the confusion here (and it is confusing, but also very cool)
This line:
metrics_names = {"metrics": ["name", "bias", "r2"]} task.connect(metrics_names)When running in "manual mode" (i.e. not by an agent), will take the dict metrics_names and put it on the Tasks HyperParameters section.
But, when executed by the Agent, it will do the opposite! it will take the data stored on the Task's hyperparameters section and put it back into the metrics_names variable. You can test it with: Task.debug_simulate_remote_task('my_task_id_that_I_generated_before_here')
metrics_names = {"metrics": ["name", "bias", "r2"]}
task = Task.init(project_name='debug', task_name='check connect dict')
task.connect(metrics_names)

print(metrics_names)
print(type(metrics_names)) `Make sense ?

  
  
Posted 3 years ago
1K Views
10 Answers
3 years ago
one year ago
Tags