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, I Have A Case When I Want To Clone Tasks And Set Some Parameters For Them. I Noticed, That I Can'T Pass Numbers, Only Strings Are Possible There. When I'M Trying To Pass A Number, The Default Value Is Not Overriden. Do You Know Maybe If Numbers Can Be

Hi, I have a case when I want to clone tasks and set some parameters for them. I noticed, that I can't pass numbers, only strings are possible there. When I'm trying to pass a number, the default value is not overriden. Do you know maybe if numbers can be passed there in some way?

` cloned = Task.clone(
...
)

s = cloned.get_parameters_as_dict()

does not work

s['Function']['random_number'] = random.random()

s['Function']['random_number'] = f'{random.random()}'
cloned.set_parameters_as_dict(s) `

  
  
Posted one year ago
Votes Newest

Answers 8


Hi RoundMosquito25 ! What clearml version are you using? Do you get any error messages when you are setting floats instead of strings?

  
  
Posted one year ago

After you do s['Function']['random_number'] = random.random() you still need to call set_parameters_as_dict(s)

  
  
Posted one year ago

version 1.8.1
No, there are no error messages. The behaviour is just very strange (or even incorrect)

Suppose that this is a task that is cloned:
base_task = replacement_task.create_function_task( func=some_func, # type: Callable func_name=f'func_id_run_me_remotely_nr', # type:Optional[str] task_name=f'a func task', # type:Optional[str] # everything below will be passed directly to our function as arguments some_argument=message, some_argument_2=message, random_number=2 )
When in the code above I do for example
s['Function']['random_number'] = random.random()
Then in some_func
argument random_number is 2 (instead of random number).

When I pass a string, then in some_func I'll parse it to float again - it works

  
  
Posted one year ago

So seems like this dictionary works with strings

  
  
Posted one year ago

yes, sure, I'm doing that

  
  
Posted one year ago

RoundMosquito25 you might need to use cast=True when you get the parameters.
See this snippet:
` from clearml import Task

t = Task.init()
params = {}
params["Function"] = {}
params["Function"]["number"] = 123
t.set_parameters_as_dict(params)
t.close()

cloned = Task.clone(t.id)
s = cloned.get_parameters_as_dict(cast=True)
s["Function"]["number"] = 321
cloned.set_parameters_as_dict(s)
print(type(cloned.get_parameters_as_dict(cast=True)["Function"]["number"])) # will print 'int' `

  
  
Posted one year ago

I'll try that...

  
  
Posted one year ago

in both cases

  
  
Posted one year ago
701 Views
8 Answers
one year ago
one year ago
Tags