Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions client/ayon_usd/addon.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,8 @@ def _download_global_lakefs_binaries(self):
json.dump(init_data, json_file)

if not utils.is_usd_lib_download_needed(settings):
self.log.info("USD Libs already available. Skipping download.")
# self.log.info("USD Libs already available. Skipping download.")
self.log.info("USD Libs are not needed or are already available. Skipping download.")
return

lake_fs_usd_lib_path = config.get_lakefs_usdlib_path(settings)
Expand Down Expand Up @@ -146,4 +147,4 @@ def _download_global_lakefs_binaries(self):
)
download_ui.setStyleSheet(style.load_stylesheet())
download_ui.start()
self._download_window = download_ui
self._download_window = download_ui
33 changes: 26 additions & 7 deletions client/ayon_usd/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,24 +29,43 @@ def get_global_lake_instance(settings=None):
if not settings:
settings = get_studio_settings()
distribution = settings["usd"]["distribution"]
return wrapper.LakeCtl(

_LocalCache.lake_instance = wrapper.LakeCtl(
server_url=distribution["server_uri"],
access_key_id=distribution["access_key_id"],
secret_access_key=distribution["secret_access_key"],
)
return _LocalCache.lake_instance


def _normalize_lakefs_repo_root(lake_fs_repo: str) -> str:
"""Return a repo URI normalized for repo-root operations."""
lake_fs_repo = lake_fs_repo.strip()
if not lake_fs_repo.endswith("/"):
lake_fs_repo = f"{lake_fs_repo}/"
return lake_fs_repo


def _normalize_lakefs_repo_base(lake_fs_repo: str) -> str:
"""Return a repo URI normalized for object-path construction."""
return lake_fs_repo.strip().rstrip("/")

def _get_lakefs_repo_items(lake_fs_repo: str) -> list:

def _get_lakefs_repo_items(lake_fs_repo: str, settings=None) -> list:
"""Return all repo object names in the LakeFS repository"""
if not lake_fs_repo:
return []
return get_global_lake_instance().list_repo_objects(lake_fs_repo)

lake_fs_repo = _normalize_lakefs_repo_root(lake_fs_repo)

return get_global_lake_instance(settings).list_repo_objects(lake_fs_repo)


def get_lakefs_usdlib_name(lake_fs_repo: str) -> str:
def get_lakefs_usdlib_name(lake_fs_repo: str, settings=None) -> str:
"""Return AyonUsdBin/usd LakeFS repo object name for current platform."""
platform_name = platform.system().lower()
lake_fs_repo_items = _get_lakefs_repo_items(lake_fs_repo)
lake_fs_repo = _normalize_lakefs_repo_base(lake_fs_repo)
lake_fs_repo_items = _get_lakefs_repo_items(lake_fs_repo, settings)
for item in lake_fs_repo_items:
if "AyonUsdBin/usd" in item and platform_name in item:
return item
Expand All @@ -60,6 +79,6 @@ def get_lakefs_usdlib_name(lake_fs_repo: str) -> str:
def get_lakefs_usdlib_path(settings: dict) -> str:
"""Return AyonUsdBin/usd LakeFS full url for current platform. """
lake_fs_repo = settings["usd"]["distribution"]["server_repo"]
lake_fs_repo = lake_fs_repo.strip().rstrip("/")
usd_lib_conf = get_lakefs_usdlib_name(lake_fs_repo)
lake_fs_repo = _normalize_lakefs_repo_base(lake_fs_repo)
usd_lib_conf = get_lakefs_usdlib_name(lake_fs_repo, settings=settings)
return f"{lake_fs_repo}/{usd_lib_conf}"
3 changes: 3 additions & 0 deletions client/ayon_usd/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ def is_usd_lib_download_needed(settings: dict) -> bool:
bool: When true, a new download is required.

"""
# currently there is no need to download usd libs
return False
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of returning False here shouldn't we just on tray_start() not call the download method to begin with? No need to log anything if we're hardcoding it to 'not download it' anyway?


lake_fs_repo = settings["usd"]["distribution"]["server_repo"]
usd_lib_dir = os.path.abspath(get_downloaded_usd_root(lake_fs_repo))
if not os.path.exists(usd_lib_dir):
Expand Down
2 changes: 1 addition & 1 deletion server/settings/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ class BinaryDistributionSettings(BaseSettingsModel):
"value to use the USD builds we provide.",
)
server_repo: str = SettingsField(
"lakefs://ayon-usd/v1.0.1/",
"lakefs://ayon-usd/v1.1.2/",
title="Repository URI",
description="The repository tag or branch URI within the LakeFs server.",
)
Expand Down
Loading