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 Again. As I Am Running My Experiment From Server Using Agent, I Am Failing On The Point, Where The Arguments Of Argparse Are Processed. When Is The Agent Task Registered. I Am Getting None For Task.Current_Task() At The Begining Of My Script.

Hi again. As I am running my experiment from server using agent, I am failing on the point, where the arguments of argparse are processed. When is the agent Task registered. I am getting None for Task.current_task() at the begining of my script.

  
  
Posted 4 years ago
Votes Newest

Answers 15


Thanks for reply. It gave me little bit more understanding I needed.
In my case, I am trying to integrate trains to already existing code, which has little bit more complicated args parsing, which forces me to get trains-server stored parameters during the parser definition. I think I understand the issue a little bit more now, so l will try some new approaches. Thanks Martin, your responses are very good.

  
  
Posted 4 years ago

WorriedParrot51 trains should support subparsers etc.
Even if your code calls the parsing before trains.
The only thing you need is to import the package when argparser is called (not to initialize it, that can happen later)
It should (hopefully) solve the issue.

  
  
Posted 4 years ago

(i.e. importing the trains package is enough to patch the argparser, only when you call the task.init the arguments will be logged, before they are stored in memory)

  
  
Posted 4 years ago

I see ... not sure if it is what I need, but how you can use:
config_file = task.connect_configuration(config_file)when (and I might be getting it not right) you did not inited the task locally ... or shall I call the Task.init even from the agent?

  
  
Posted 3 years ago

well I have certain parameters, that are not in args, but are in separate file. I am trying to use the file when calling locally, but to use trains-server-set parameters when being called from agent.

  
  
Posted 3 years ago

on the other hand, I probably can get them from args as well ...

  
  
Posted 3 years ago

Hi WorriedParrot51
Let me shed some light on this complicated mechanism, because this is not very straight forward.
Basically the agent signals the trains package it should ignore the code calls, and use a specific Task in the backend (i.e. if in manual mode, the trains package logs the data into the trains-server, in agent mode (remote mode), it does the opposite and takes the data from the trains-server "into" the code)

Specifically, just like in manual mode, calling argparse.parse is being patched by Trains, and logs the parsed arguments, the same happens in remote mode only it put backs the values instead of reading them.

Calling parse before/after the Task.init is already taken care by the trains logic (whether manual or remote mope)

Specifically, where is the issue in your case, i.e. what happens with the argparser? Do you get the updated values ?

  
  
Posted 4 years ago

Hi WorriedParrot51 , what do you mean by "call get_parameters_as_dict() from agent" ?
Do you mean like change the trains-agent to run the task differently?
Or inside your code while the trains agent runs it?
From the code itself (regardless off how you run it) you can always call, and get the current states parameters (i.e. from backend if running with trains-agent, or copied from the code, if running manually)
task.get_parameters_as_dict()

  
  
Posted 3 years ago

AgitatedDove14 One more. So how can I call get_parameters_as_dict() from agent as I do not have task?

  
  
Posted 3 years ago

I was trying to call parse (earlier than necessary) only in case it runs on agent. Therefore I was trying to get the current task, assuming, that when I am calling if from agent, the Task is already initialized. So, as I am getting it right, the agent is not creating (initializing) the Task, correct?

  
  
Posted 4 years ago

It will store the entire content of the file, then you can edit it in the UI, and in remote it will return a new local copy of the file (based on the data in the UI) for you to read.

  
  
Posted 3 years ago

Hi WorriedParrot51
Assuming you run the code "manually" once (i.e. without the agent). Then when you call Task.init it will register the argparser.
When running with the agent, the first time you will call parse, it will automatically override the argparse defaults with the values stored in the Task.
Make sesne?

am getting None for Task.current_task() at the beginning of my script.

Task.init() is doing the magic , only after this call you will have current_task (either running manually or with an agent)

  
  
Posted 4 years ago

or shall I call the Task.init even from the agent

WorriedParrot51 I think something is lost here.
Task.init() is always called, even when the agent is executing the code. The difference is in what happens inside the Task.init() call. When the codebase itself is executed by the trains-agent, it signals through OS environment to the task.init() that instead of a new created task, it should use the already created one. from this point all data flows from the trains-server back into the code.
Make sense to you?

  
  
Posted 3 years ago

Ok ... make sense now 😄

  
  
Posted 3 years ago
697 Views
15 Answers
4 years ago
one year ago
Tags