Skip to content

Commit

Permalink
Merge pull request princeton-vl#311 from princeton-vl/upload_copy
Browse files Browse the repository at this point in the history
Add copyfile upload mode
  • Loading branch information
pvl-bot authored Oct 18, 2024
2 parents 7c67fc0 + d15a337 commit aa9724d
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions infinigen/datagen/util/upload_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,18 @@ def rclone_upload_file(src_file, dst_folder):
print(f"Uploaded {src_file}")


def copy_upload_file(src_file, dst_folder, root_dir):
assert os.path.exists(src_file), src_file
if dst_folder.as_posix().startswith("infinigen/renders"):
dst_folder = dst_folder.as_posix().split("/")[-1]

if not os.path.exists(f"{root_dir}/{dst_folder}"):
os.makedirs(f"{root_dir}/{dst_folder}")

shutil.copy2(src_file, f"{root_dir}/{dst_folder}")
print(f"Copy {src_file}")


def get_commit_hash():
git = shutil.which("git")
if git is None:
Expand Down Expand Up @@ -180,6 +192,8 @@ def get_upload_func(method="smbclient"):
return rclone_upload_file
elif method == "smbclient":
return smb_client.upload
elif method.startswith("copyfile"):
return lambda x, y: copy_upload_file(x, y, root_dir=method.split(":")[-1])
else:
raise ValueError(f"Unrecognized {method=}")

Expand Down

0 comments on commit aa9724d

Please sign in to comment.