6
6
import copy
7
7
8
8
9
+ def convert_to_abs_path (path ):
10
+ if not os .path .isabs (path ):
11
+ path = os .path .abspath (path )
12
+ return path
13
+
14
+
9
15
def process_mounts (mounts , env , docker_settings , f_run_cmd ):
10
16
"""
11
17
Processes and updates the Docker mounts based on the provided inputs and environment variables.
@@ -63,7 +69,6 @@ def process_mounts(mounts, env, docker_settings, f_run_cmd):
63
69
else : # Skip mount if variable is missing
64
70
mounts [index ] = None
65
71
break
66
-
67
72
# Skip further processing if the mount was invalid
68
73
if mounts [index ] is None :
69
74
continue
@@ -241,7 +246,6 @@ def update_container_paths(path, mounts=None, force_target_path=''):
241
246
if mounts is not None :
242
247
if all (mount .lower () != mount_entry .lower () for mount in mounts ):
243
248
mounts .append (mount_entry )
244
-
245
249
return host_path , container_path
246
250
247
251
@@ -387,9 +391,10 @@ def get_docker_default(key):
387
391
388
392
389
393
def get_host_path (value ):
394
+ # convert relative path to absolute path
395
+ value = convert_to_abs_path (value )
396
+
390
397
path_split = value .split (os .sep )
391
- if len (path_split ) == 1 :
392
- return value
393
398
394
399
new_value = ''
395
400
if "cache" in path_split and "local" :
@@ -413,9 +418,10 @@ def get_container_path_script(i):
413
418
414
419
415
420
def get_container_path (value , username = "mlcuser" ):
421
+ # convert relative path to absolute path
422
+ value = convert_to_abs_path (value )
423
+
416
424
path_split = value .split (os .sep )
417
- if len (path_split ) == 1 :
418
- return value , value
419
425
420
426
new_value = ''
421
427
if "cache" in path_split and "local" in path_split :
0 commit comments