Skip to content

Commit

Permalink
[Spot/Serve] Fix file mount translate (#3480)
Browse files Browse the repository at this point in the history
* Fix file mount translate

* Update sky/utils/controller_utils.py

Co-authored-by: Romil Bhardwaj <[email protected]>

---------

Co-authored-by: Romil Bhardwaj <[email protected]>
  • Loading branch information
Michaelvll and romilbhardwaj authored Apr 25, 2024
1 parent 34b55f9 commit 8a18133
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions sky/utils/controller_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -606,13 +606,16 @@ def maybe_translate_local_file_mounts_and_sync_up(task: 'task_lib.Task',
# Step 5: Add the file download into the file mounts, such as
# /original-dst: s3://spot-fm-file-only-bucket-name/file-0
new_file_mounts = {}
storage = task.storage_mounts[file_mount_remote_tmp_dir]
store_type = list(storage.stores.keys())[0]
store_prefix = store_type.store_prefix()
bucket_url = store_prefix + file_bucket_name
for dst, src in copy_mounts_with_file_in_src.items():
file_id = src_to_file_id[src]
new_file_mounts[dst] = bucket_url + f'/file-{file_id}'
if copy_mounts_with_file_in_src:
# file_mount_remote_tmp_dir will only exist when there are files in
# the src for copy mounts.
storage = task.storage_mounts[file_mount_remote_tmp_dir]
store_type = list(storage.stores.keys())[0]
store_prefix = store_type.store_prefix()
bucket_url = store_prefix + file_bucket_name
for dst, src in copy_mounts_with_file_in_src.items():
file_id = src_to_file_id[src]
new_file_mounts[dst] = bucket_url + f'/file-{file_id}'
task.update_file_mounts(new_file_mounts)

# Step 6: Replace the source field that is local path in all storage_mounts
Expand Down

0 comments on commit 8a18133

Please sign in to comment.