11import os
22from mlc import utils
33from utils import *
4- from pathlib import PureWindowsPath , PurePosixPath
4+ from pathlib import PureWindowsPath , PurePosixPath , Path
55from script .docker_utils import *
66import copy
77
8+ def convert_to_abs_path (path ):
9+ if not os .path .isabs (path ):
10+ path = os .path .abspath (path )
11+ return path
812
913def process_mounts (mounts , env , docker_settings , f_run_cmd ):
1014 """
@@ -63,7 +67,6 @@ def process_mounts(mounts, env, docker_settings, f_run_cmd):
6367 else : # Skip mount if variable is missing
6468 mounts [index ] = None
6569 break
66-
6770 # Skip further processing if the mount was invalid
6871 if mounts [index ] is None :
6972 continue
@@ -241,7 +244,6 @@ def update_container_paths(path, mounts=None, force_target_path=''):
241244 if mounts is not None :
242245 if all (mount .lower () != mount_entry .lower () for mount in mounts ):
243246 mounts .append (mount_entry )
244-
245247 return host_path , container_path
246248
247249
@@ -387,6 +389,9 @@ def get_docker_default(key):
387389
388390
389391def get_host_path (value ):
392+ # convert relative path to absolute path
393+ value = convert_to_abs_path (value )
394+
390395 path_split = value .split (os .sep )
391396 if len (path_split ) == 1 :
392397 return value
@@ -413,6 +418,9 @@ def get_container_path_script(i):
413418
414419
415420def get_container_path (value , username = "mlcuser" ):
421+ # convert relative path to absolute path
422+ value = convert_to_abs_path (value )
423+
416424 path_split = value .split (os .sep )
417425 if len (path_split ) == 1 :
418426 return value , value
0 commit comments