Fix clearml-task failing without a docker script. Issue #378

This commit is contained in:
allegroai 2021-06-09 02:46:46 +03:00
parent 53d25b7675
commit 332ceab3ea

View File

@ -55,7 +55,7 @@ def setup_parser(parser):
help='Add docker arguments, pass a single string') help='Add docker arguments, pass a single string')
parser.add_argument('--docker_bash_setup_script', type=str, default=None, parser.add_argument('--docker_bash_setup_script', type=str, default=None,
help="Add bash script to be executed inside the docker before setting up " help="Add bash script to be executed inside the docker before setting up "
"the Task's environement") "the Task's environment")
parser.add_argument('--task-type', type=str, default=None, parser.add_argument('--task-type', type=str, default=None,
help='Set the Task type, optional values: ' help='Set the Task type, optional values: '
'training, testing, inference, data_processing, application, monitor, ' 'training, testing, inference, data_processing, application, monitor, '
@ -82,15 +82,15 @@ def cli():
print('Version {}'.format(__version__)) print('Version {}'.format(__version__))
exit(0) exit(0)
if Path(args.docker_bash_setup_script).is_file(): if args.docker_bash_setup_script and Path(args.docker_bash_setup_script).is_file():
with open(Path(args.docker_bash_setup_script), "r") as bash_setup_script_file: with open(args.docker_bash_setup_script, "r") as bash_setup_script_file:
bash_setup_script = bash_setup_script_file.readlines() bash_setup_script = bash_setup_script_file.readlines()
# remove Bash Shebang # remove Bash Shebang
if bash_setup_script[0].startswith("#!"): if bash_setup_script and bash_setup_script[0].strip().startswith("#!"):
bash_setup_script = bash_setup_script[1:] bash_setup_script = bash_setup_script[1:]
else: else:
bash_setup_script = args.docker_bash_setup_script bash_setup_script = args.docker_bash_setup_script or None
create_populate = CreateAndPopulate( create_populate = CreateAndPopulate(
project_name=args.project, project_name=args.project,
task_name=args.name, task_name=args.name,