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'M Setting A

Hi,
I'm setting a USER PROPERTIES using the following code
task.set_user_properties(MY_THRESHOLD={"type": int, "value": 0.85}, )Whet is the correct way to retrieve the value?
using task.get_user_properties().get('MY_THRESHOLD').get('value') requires the conversion back to int
I'm sure I'm missing something

  
  
Posted 2 years ago
Votes Newest

Answers 9


task.get_parameters and task.get_parameters_as_dict have the keyword argument cast which attempts to convert values back to their original type, but interestingly doesn't seem to work for properties:

` task = Task.init()
task.set_user_properties(x=5)
task.connect({"a":5})
task.get_parameters_as_dict(cast=True)

{'General': {'a': 5}, 'properties': {'x': '5'}} Hopefully would be a relatively easy extension of get_user_properties ` !

  
  
Posted 2 years ago

How would you use the

user properties

as part of an experiment?

I'm guessing to get the properties. I'm guessing this really depends on your needs / use-case

  
  
Posted 2 years ago

You are getting a string - '5'
I want to get an int - 5

  
  
Posted 2 years ago

exactly - (that is how I used it in my initial code) - but if you have to convert it back to the original data type then something is broken...

  
  
Posted 2 years ago

Thx for investigating - What is the use case for such behavior ?
How would you use the user properties as part of an experiment?

  
  
Posted 2 years ago

I played a bit with it and got to the value. OutrageousSheep60 , please tell me if this helps you 🙂

` >>> task.set_user_properties(x=5)
True

y=task.get_user_properties()
y
{'x': {'section': 'properties', 'name': 'x', 'value': '5'}}
y["x"]["value"]
'5' `

  
  
Posted 2 years ago

Yeah I see what you're saying. It doesn't keep it's type. This might be a bug.

  
  
Posted 2 years ago

OutrageousSheep60 , it looks like it's not a bug. Internally x is stored as an int , however get_user_properties() casts it back as a string. You could open a github issue with a feature request for this 🙂

  
  
Posted 2 years ago
1K Views
9 Answers
2 years ago
one year ago
Tags