mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-25 05:14:40 +01:00
use Deadline 'ProcessUtils' to run openpype process
This commit is contained in:
parent
c178d6e2a1
commit
4161b3b48d
1 changed files with 15 additions and 16 deletions
|
|
@ -7,7 +7,12 @@ import json
|
|||
import platform
|
||||
import uuid
|
||||
import re
|
||||
from Deadline.Scripting import RepositoryUtils, FileUtils, DirectoryUtils
|
||||
from Deadline.Scripting import (
|
||||
RepositoryUtils,
|
||||
FileUtils,
|
||||
DirectoryUtils,
|
||||
ProcessUtils,
|
||||
)
|
||||
|
||||
|
||||
def get_openpype_version_from_path(path, build=True):
|
||||
|
|
@ -162,7 +167,6 @@ def inject_openpype_environment(deadlinePlugin):
|
|||
print(">>> Temporary path: {}".format(export_url))
|
||||
|
||||
args = [
|
||||
exe,
|
||||
"--headless",
|
||||
"extractenvironments",
|
||||
export_url
|
||||
|
|
@ -188,21 +192,16 @@ def inject_openpype_environment(deadlinePlugin):
|
|||
if not os.environ.get("OPENPYPE_MONGO"):
|
||||
print(">>> Missing OPENPYPE_MONGO env var, process won't work")
|
||||
|
||||
env = os.environ
|
||||
env["AVALON_TIMEOUT"] = "5000"
|
||||
os.environ["AVALON_TIMEOUT"] = "5000"
|
||||
|
||||
print(">>> Executing: {}".format(" ".join(args)))
|
||||
proc = subprocess.Popen(
|
||||
args,
|
||||
cwd=os.path.dirname(exe),
|
||||
env=env,
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.PIPE,
|
||||
)
|
||||
std_output, std_err = proc.communicate()
|
||||
print(">>> Process result {}\n".format(std_output, std_err))
|
||||
if proc.returncode != 0:
|
||||
raise RuntimeError("OpenPype process failed.")
|
||||
args_str = subprocess.list2cmdline(args)
|
||||
print(">>> Executing: {} {}".format(exe, args_str))
|
||||
process = ProcessUtils.SpawnProcess(exe, args_str, os.path.dirname(exe))
|
||||
ProcessUtils.WaitForExit(process, -1)
|
||||
if process.ExitCode != 0:
|
||||
raise RuntimeError(
|
||||
"Failed to run OpenPype process to extract environments."
|
||||
)
|
||||
|
||||
print(">>> Loading file ...")
|
||||
with open(export_url) as fp:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue