@@ -78,10 +78,16 @@ def process_mounts(mounts, env, docker_settings, f_run_cmd):
78
78
79
79
# Update container environment string and mappings
80
80
if host_env_key :
81
- container_env_string += f" --env.{ host_env_key } ={ container_env_key } "
81
+ # We are modifying the input mapping variables wrt to the new container env variable. Is explicit passing of env variable necessary?
82
+ # container_env_string += f" --env.{host_env_key}={container_env_key} "
82
83
for key , value in docker_input_mapping .items ():
83
84
if value == host_env_key :
84
- f_run_cmd [key ] = container_env_key
85
+ # If we want to pass/mount a filepath, now its mounting its parent folder
86
+ # and in the input, along with the parent folder, filename is also passed to access
87
+ if os .path .basename (env [host_env_key ]) != "" :
88
+ f_run_cmd [key ] = os .path .join (container_env_key , os .path .basename (env [host_env_key ]))
89
+ else :
90
+ f_run_cmd [key ] = container_env_key
85
91
86
92
# Remove invalid mounts and construct mount string
87
93
mounts = [item for item in mounts if item is not None ]
@@ -392,7 +398,7 @@ def get_docker_default(key):
392
398
393
399
def get_host_path (value ):
394
400
# convert relative path to absolute path
395
- value = convert_to_abs_path (value )
401
+ value = os . path . dirname ( convert_to_abs_path (value ) )
396
402
397
403
path_split = value .split (os .sep )
398
404
@@ -419,7 +425,8 @@ def get_container_path_script(i):
419
425
420
426
def get_container_path (value , username = "mlcuser" ):
421
427
# convert relative path to absolute path
422
- value = convert_to_abs_path (value )
428
+ # if we are trying to mount a file, mount the parent folder.
429
+ value = os .path .dirname (convert_to_abs_path (value ))
423
430
424
431
path_split = value .split (os .sep )
425
432
0 commit comments