Reputation
Badges 1
13 × Eureka!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.
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?
AgitatedDove14 One more. So how can I call get_parameters_as_dict() from agent as I do not have task?
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?
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.
Sorry. I have read your reply now again and realize, that it will probably not solve my problem. The repo I am using has the script, that is being run, but it has a lot of python modules, that are being used as well, but not in relative way, but using PYTHONPATH. So this is the reason, why I need to set the pythonpath env variable to place (plus one subfolder) where the repo is clonned on agent start.
ADD: Yep, it did not work. So is there any way, how the ENV variable can be set as in docker...
I have solved the problem by adding docker_arguments
to self._extra_docker_arguments
on line: https://github.com/allegroai/trains-agent/blob/master/trains_agent/commands/worker.py#L2105 which works exactly as I need.
Well, I went into the code and found several suspicious parts around docker commands:
This is the first part, where the docker commands do not work: https://github.com/allegroai/trains-agent/blob/master/trains_agent/commands/worker.py#L2108 Calling functor here has probably switched params: https://github.com/allegroai/trains-agent/blob/master/trains_agent/commands/worker.py#L2122 and then here https://github.com/allegroai/trains-agent/blob/master/trains_agent/commands/worker.py#L2011So I...
Thanks for reply. I will check on it and get back to you with result.
M: "So I think what you need is to map your external code into the docker, is that correct?"
K: No. The code, that must be in PYTHONPATH is part of the repo being cloned by agent, but must be referenced in PYTHONPATH, because of multiple modules being referenced from that path.
M: "You can achieve both by configuring the trains.conf"
K: For variability reason, I hope that it would be possible, to configure this for each agent separately in initial command (which is obviously impossible by now...
I will try the #2 - that can be good as well. Thanks. ADD: Yep. Works well.
on the other hand, I probably can get them from args as well ...