Guest User

Untitled

a guest
Sep 10th, 2024
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.96 KB | None | 0 0
  1. import clearml
  2. from pathlib import Path
  3. from cloudpathlib import S3Path
  4.  
  5. # Files in dir:
  6. # a.txt
  7. # b.txt
  8. zip_dir = Path("./files")
  9.  
  10. # Files in dir:
  11. # b.txt
  12. # c.txt
  13. ext_dir = S3Path("s3://rnd-dev/temp/broken_zip_example/files")
  14.  
  15. ds_v1 = clearml.Dataset.create(
  16.     dataset_project="test",
  17.     dataset_name="broken-links",
  18.     dataset_version="1.0.0",
  19.     description="Contains just file entries",
  20. )
  21. ds_v1.add_files(zip_dir)
  22. ds_v1.upload()
  23. ds_v1.finalize()
  24.  
  25. ds_v2 = clearml.Dataset.create(
  26.     dataset_project="test",
  27.     dataset_name="broken-links",
  28.     dataset_version="2.0.0",
  29.     description="Files modified with ext links",
  30.     parent_datasets=[ds_v1],
  31. )
  32. ds_v2.add_external_files("s3://SR_URL/rnd-dev/temp/broken_zip_example/files")
  33. ds_v2.upload()
  34. ds_v2.finalize()
  35.  
  36. # Files in path
  37. # a.txt -> Symlinked to v1 a.txt
  38. # b.txt -> Symlinked to v1 b.txt (broken, should've been the b.txt from S3)
  39. # c.txt
  40. ds_v2_path = ds_v2.get_local_copy()
  41.  
Advertisement
Add Comment
Please, Sign In to add comment