From 3de95063ee7038040012b8a18640b7ac2d8e15d6 Mon Sep 17 00:00:00 2001 From: allegroai <> Date: Fri, 8 May 2020 21:33:54 +0300 Subject: [PATCH] Remove auto_connect_arg_parser constraint when ArgumentParser.parse_arg() is used before initializing task --- trains/task.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/trains/task.py b/trains/task.py index e6b6426e..923624b0 100644 --- a/trains/task.py +++ b/trains/task.py @@ -439,11 +439,10 @@ class Task(_Task): parser, parsed_args = get_argparser_last_args() task._connect_argparse(parser=parser, parsed_args=parsed_args) elif argparser_parseargs_called(): - # parse_args was automatically patched, but auto_connect_arg_parser is False... - raise UsageError("ArgumentParser.parse_args() was automatically connected to this task, " - "although auto_connect_arg_parser is turned off!\n" - "When turning off auto_connect_arg_parser, call Task.init(...) " - "before calling ArgumentParser.parse_args()") + # actually we have nothing to do, in remote running, the argparser will ignore + # all non argparser parameters, only caveat if parameter connected with the same name + # as the argparser this will be solved once sections are introduced to parameters + pass # Make sure we start the logger, it will patch the main logging object and pipe all output # if we are running locally and using development mode worker, we will pipe all stdout to logger.