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
8 changes: 4 additions & 4 deletions client/ayon_usd/hooks/usd_pinning_root.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,16 @@ class UsdPinningRoot(PreLaunchHook):

def execute(self) -> None:
"""Set environments necessary for pinning."""
if not self.launch_context.env.get("PINNING_FILE_PATH"):
if not self.launch_context.env.get("AYON_USD_RESOLVER_PINNING_FILE"):
return

anatomy = self.data["anatomy"]
self.launch_context.env["PINNING_FILE_PATH"] = anatomy.fill_root(
self.launch_context.env.get("PINNING_FILE_PATH"),
self.launch_context.env["AYON_USD_RESOLVER_PINNING_FILE"] = anatomy.fill_root(
self.launch_context.env.get("AYON_USD_RESOLVER_PINNING_FILE"),
)

roots = anatomy.roots
self.launch_context.env[
"PROJECT_ROOTS"
"AYON_USD_RESOLVER_PINNING_ROOTS"
] = ",".join(f"{key}={value}"
for key, value in roots.items())
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,12 @@ def process(self, instance: pyblish.api.Instance) -> None:
os.path.dirname(usd_file_path), pin_file_name
)

project_roots = ayon_api.get_project_roots_by_site_id(
AYON_USD_RESOLVER_PINNING_ROOTS = ayon_api.get_project_roots_by_site_id(
instance.context.data["projectName"]
)
generate_pinning_file(
usd_file_path,
project_roots,
AYON_USD_RESOLVER_PINNING_ROOTS,
pin_file_path
)

Expand All @@ -77,8 +77,8 @@ def process(self, instance: pyblish.api.Instance) -> None:
FARM_JOB_ENV_DATA_KEY, {}
)
farm_job_data.update({
"PINNING_FILE_PATH": pin_file_path,
"ENABLE_STATIC_GLOBAL_CACHE": "1",
"AYON_USD_RESOLVER_PINNING_FILE": pin_file_path,
"AYON_USD_RESOLVER_ENABLE_PINNING": "1",
})

def get_usd_file_path(self, instance):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ def _write_pinning_file(


def generate_pinning_file(
entry_usd: str, root_info: Dict[str, str], pinning_file_path: str
entry_usd: str, root_info: Dict[str, str], AYON_USD_RESOLVER_PINNING_FILE: str
):
"""Generate a AYON USD Resolver pinning file.

Expand All @@ -315,13 +315,13 @@ def generate_pinning_file(
root_info: The project roots for the site the pinning should resolve
to. These can be obtained via e.g. the AYON REST API get
`/api/projects/{project_name}/siteRoots".
pinning_file_path: The destination path to write the pinning file to.
AYON_USD_RESOLVER_PINNING_FILE: The destination path to write the pinning file to.

"""

if not pinning_file_path.endswith(".json"):
if not AYON_USD_RESOLVER_PINNING_FILE.endswith(".json"):
raise RuntimeError(
f"Pinning file path is not a json file {pinning_file_path}")
f"Pinning file path is not a json file {AYON_USD_RESOLVER_PINNING_FILE}")

# Assume that the environment sets up the correct default AyonUsdResolver
resolver = Ar.GetResolver()
Expand All @@ -344,6 +344,6 @@ def generate_pinning_file(
)

_write_pinning_file(
pinning_file_path,
AYON_USD_RESOLVER_PINNING_FILE,
rootless_pinning_data,
)
6 changes: 3 additions & 3 deletions client/ayon_usd/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,9 +210,9 @@ def _append(_env: dict, key: str, path: str):
resolver_settings = settings["usd"]["ayon_usd_resolver"]
return {
"TF_DEBUG": settings["usd"]["usd"]["usd_tf_debug"],
"AYONLOGGERLOGLVL": resolver_settings["ayon_log_lvl"],
"AYONLOGGERSFILELOGGING": resolver_settings["ayon_file_logger_enabled"], # noqa
"AYONLOGGERSFILEPOS": resolver_settings["file_logger_file_path"],
"AYON_USD_RESOLVER_LOG_LVL": resolver_settings["ayon_log_lvl"],
"AYON_USD_RESOLVER_LOG_FILE_ENABLED": resolver_settings["ayon_file_logger_enabled"], # noqa
"AYON_USD_RESOLVER_LOG_FILE": resolver_settings["file_logger_file_path"],
"AYON_LOGGIN_LOGGIN_KEYS": resolver_settings["ayon_logger_logging_keys"], # noqa
"PXR_PLUGINPATH_NAME": pxr_pluginpath_name,
"PYTHONPATH": python_path,
Expand Down
2 changes: 1 addition & 1 deletion docs/Ayon_Docs/Dev_Docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ creates a pinning file JSON from a given USD stage

```py
def generate_pinning_file(
entry_usd: str, root_info: Dict[str, str], pinning_file_path: str
entry_usd: str, root_info: Dict[str, str], AYON_USD_RESOLVER_PINNING_FILE: str
):
```

Expand Down
Loading