mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-24 21:04:40 +01:00
Merge pull request #2091 from pypeclub/PYPE-1310_client-start-of-openpype-with-google-drive-stream-path-remaping
Added running configurable disk mapping command before start of OP
This commit is contained in:
commit
a5abaa6068
6 changed files with 112 additions and 1 deletions
|
|
@ -7,6 +7,11 @@
|
|||
"global": []
|
||||
}
|
||||
},
|
||||
"disk_mapping": {
|
||||
"windows": [],
|
||||
"linux": [],
|
||||
"darwin": []
|
||||
},
|
||||
"openpype_path": {
|
||||
"windows": [],
|
||||
"darwin": [],
|
||||
|
|
|
|||
|
|
@ -40,6 +40,75 @@
|
|||
{
|
||||
"type": "splitter"
|
||||
},
|
||||
{
|
||||
"type": "dict",
|
||||
"key": "disk_mapping",
|
||||
"label": "Disk mapping",
|
||||
"use_label_wrap": false,
|
||||
"collapsible": false,
|
||||
"children": [
|
||||
{
|
||||
"key": "windows",
|
||||
"label": "Windows",
|
||||
"type": "list",
|
||||
"object_type": {
|
||||
"type": "list-strict",
|
||||
"key": "item",
|
||||
"object_types": [
|
||||
{
|
||||
"label": "Source",
|
||||
"type": "path"
|
||||
},
|
||||
{
|
||||
"label": "Destination",
|
||||
"type": "path"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"key": "linux",
|
||||
"label": "Linux",
|
||||
"type": "list",
|
||||
"object_type": {
|
||||
"type": "list-strict",
|
||||
"key": "item",
|
||||
"object_types": [
|
||||
{
|
||||
"label": "Source",
|
||||
"type": "path"
|
||||
},
|
||||
{
|
||||
"label": "Destination",
|
||||
"type": "path"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"key": "darwin",
|
||||
"label": "MacOS",
|
||||
"type": "list",
|
||||
"object_type": {
|
||||
"type": "list-strict",
|
||||
"key": "item",
|
||||
"object_types": [
|
||||
{
|
||||
"label": "Source",
|
||||
"type": "path"
|
||||
},
|
||||
{
|
||||
"label": "Destination",
|
||||
"type": "path"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "splitter"
|
||||
},
|
||||
{
|
||||
"type": "path",
|
||||
"key": "openpype_path",
|
||||
|
|
|
|||
|
|
@ -168,7 +168,7 @@ class CacheValues:
|
|||
|
||||
class MongoSettingsHandler(SettingsHandler):
|
||||
"""Settings handler that use mongo for storing and loading of settings."""
|
||||
global_general_keys = ("openpype_path", "admin_password")
|
||||
global_general_keys = ("openpype_path", "admin_password", "disk_mapping")
|
||||
|
||||
def __init__(self):
|
||||
# Get mongo connection
|
||||
|
|
|
|||
34
start.py
34
start.py
|
|
@ -102,6 +102,8 @@ import subprocess
|
|||
import site
|
||||
from pathlib import Path
|
||||
|
||||
from igniter.tools import get_openpype_global_settings
|
||||
|
||||
|
||||
# OPENPYPE_ROOT is variable pointing to build (or code) directory
|
||||
# WARNING `OPENPYPE_ROOT` must be defined before igniter import
|
||||
|
|
@ -275,6 +277,35 @@ def run(arguments: list, env: dict = None) -> int:
|
|||
return p.returncode
|
||||
|
||||
|
||||
def run_disk_mapping_commands(mongo_url):
|
||||
""" Run disk mapping command
|
||||
|
||||
Used to map shared disk for OP to pull codebase.
|
||||
"""
|
||||
settings = get_openpype_global_settings(mongo_url)
|
||||
|
||||
low_platform = platform.system().lower()
|
||||
disk_mapping = settings.get("disk_mapping")
|
||||
if not disk_mapping:
|
||||
return
|
||||
|
||||
for mapping in disk_mapping.get(low_platform):
|
||||
source, destination = mapping
|
||||
|
||||
args = ["subst", destination.rstrip('/'), source.rstrip('/')]
|
||||
_print("disk mapping args:: {}".format(args))
|
||||
try:
|
||||
output = subprocess.Popen(args)
|
||||
if output.returncode and output.returncode != 0:
|
||||
exc_msg = "Executing args was not successful: \"{}\"".format(
|
||||
args)
|
||||
|
||||
raise RuntimeError(exc_msg)
|
||||
except TypeError:
|
||||
_print("Error in mapping drive")
|
||||
raise
|
||||
|
||||
|
||||
def set_avalon_environments():
|
||||
"""Set avalon specific environments.
|
||||
|
||||
|
|
@ -895,6 +926,9 @@ def boot():
|
|||
os.environ["OPENPYPE_MONGO"] = openpype_mongo
|
||||
os.environ["OPENPYPE_DATABASE_NAME"] = "openpype" # name of Pype database
|
||||
|
||||
_print(">>> run disk mapping command ...")
|
||||
run_disk_mapping_commands(openpype_mongo)
|
||||
|
||||
# Get openpype path from database and set it to environment so openpype can
|
||||
# find its versions there and bootstrap them.
|
||||
openpype_path = get_openpype_path_from_db(openpype_mongo)
|
||||
|
|
|
|||
|
|
@ -21,6 +21,9 @@ as a naive barier to prevent artists from accidental setting changes.
|
|||
|
||||
**`Environment`** - Globally applied environment variables that will be appended to any OpenPype process in the studio.
|
||||
|
||||
**`Disk mapping`** - Platform dependent configuration for mapping of virtual disk(s) on an artist's OpenPype machines before OP starts up.
|
||||
Uses `subst` command, if configured volume character in `Destination` field already exists, no re-mapping is done for that character(volume).
|
||||
|
||||
**`Versions Repository`** - Location where automatic update mechanism searches for zip files with
|
||||
OpenPype update packages. To read more about preparing OpenPype for automatic updates go to [Admin Distribute docs](admin_distribute#2-openpype-codebase)
|
||||
|
||||
|
|
|
|||
Binary file not shown.
|
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 33 KiB |
Loading…
Add table
Add a link
Reference in a new issue