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

Hi all 🙂
I have a question regarding task.connect_configuration() .
Does it possible to update the file on the server when running remotely or locally?

for example doing something like this:
` path = task.connect_configuration(path, name=name)
my_params = read_from_path(path)
my_params = change_parmas(my_params) # change some staff
write_file(my_params, path)

here I like to update the configuration on the server as well:

path = task.<update_configuration>(path, name=name) `

  
  
Posted 3 years ago
Votes Newest

Answers 10


Hi CooperativeFox72 ,
When running remotely, connect_configuration(path, name=name) will write the contents (stored in the task from the original connected file when running locally) into a temporary file, and return its path.
I'm not sure I understand your use-case - do you always want to change the contents of the file in your code? Why not change it before connecting?

  
  
Posted 3 years ago

CooperativeFox72 a bit of info on how it works:
In "manual" execution (i.e. without an agent)

path = task.connect_configuration(local_path, name=name

path = local_path , and the content of local_path is stored on the Task

In "remote" execution (i.e. agent)

path = task.connect_configuration(local_path, name=name

"local_path" is ignored, path is a temp file, and the content of the temp file is the content that is stored (or edited) on the Task configuration.
Make sense ?

  
  
Posted 3 years ago

This one should work:
` path = task.connect_configuration(path, name=name)
if task.running_locally():
my_params = read_from_path(path)
my_params = change_parmas(my_params) # change some staff

store back the change, my_params assumed to be the content of the param file (text)

task.set_configuration_object(name=name, config_taxt=my_params) `

  
  
Posted 3 years ago

So if I will edit the temp file

you mean from the UI or code?

  
  
Posted 3 years ago

CooperativeFox72 could you expand on "not working"?
If you have a yaml file, I would do:
` # local_path = './my_config.yaml'
path = task.connect_configuration(local_path, name=name)
if task.running_locally():
with open(local_path, "r") as config_file:
my_params_dict = yaml.load(config_file, Loader=yaml.FullLoader)
my_params_dict['change_me'] = 'new value'
my_params_text = yaml.dump(my_params_dict)

store back the change, my_params assumed to be the content of the param file (text)

task.set_configuration_object(name=name, config_text=my_params_text) `

  
  
Posted 3 years ago

looks good 🙂 thanks 🙏

  
  
Posted 3 years ago

Hi SuccessfulKoala55 and AgitatedDove14 ,
Thanks for the quick replay.

I'm not sure I understand your use-case - do you always want to change the contents of the file in your code? Why not change it before connecting?

Changing the file before the connect will make sense only when I am running locally and the file exists. Remotely I must get the file with connect_configuration(path, name=name) before I am reading it.

"local_path" is ignored, path is a temp file, and the content of the temp file is the content that is stored (or edited) on the Task configuration.
Make sense ?

So if I will edit the temp file (after using the connect_configuration ), how it will be shown on the server?

  
  
Posted 3 years ago

I tried you solution but since my path is to a YAML file,
and task.set_configuration_object(name=name, config_taxt=my_params) upload this not in the same format task.connect_configuration(path, name=name) it not working for me 😞
(even when I am using config_type='yaml' )

  
  
Posted 3 years ago

From the UI it will since it getting the temp file from there.
I mean from the code (let say remotely)

  
  
Posted 3 years ago

I tried without yaml.dump(my_params_dict) will try with it..
so the file was not the same as the connect_configuration uploaded
Thanks

  
  
Posted 3 years ago
832 Views
10 Answers
3 years ago
one year ago
Tags
Similar posts