Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Maya: Testing - OP-5060 #5644

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
70 commits
Select commit Hold shift + click to select a range
baed15f
initial commit of working Maya scene testing
tokejepsen Jul 25, 2023
63e15ab
Ingest userSetup.py
tokejepsen Jul 25, 2023
23ce48d
Ingest Maya workfile
tokejepsen Jul 25, 2023
0dd82cd
Ingest Maya workfile
tokejepsen Jul 25, 2023
e16e832
Simplify the resources naming
tokejepsen Jul 25, 2023
7b4b1ba
test_data_folder > data_folder and test_openpype_mongo > openpype_mongo
tokejepsen Jul 25, 2023
cc56520
Rename class variables
tokejepsen Jul 25, 2023
1a88975
Ingest environment json
tokejepsen Jul 25, 2023
3d2d53d
Part-refactor of setup code
tokejepsen Jul 25, 2023
423123d
refactor db_setup
tokejepsen Jul 25, 2023
99e8785
db > database
tokejepsen Jul 25, 2023
b56d7e7
Move setup only out of testing classes
tokejepsen Jul 26, 2023
4c3ac77
Separate dump_database from tests.
tokejepsen Jul 26, 2023
1d84e57
Ingested database dumps
tokejepsen Jul 26, 2023
a9c7e7b
Ingested database dumps
tokejepsen Jul 26, 2023
810d281
Refactor input environment to optional class attribute
tokejepsen Jul 26, 2023
2e8d9a0
Move input files to unique folder
tokejepsen Jul 27, 2023
0640705
Working MayaPy and Maya app variants
tokejepsen Jul 27, 2023
ba7ebf9
Tested succesfully in Maya 2022
tokejepsen Jul 28, 2023
cc2b4aa
Tested successfully in Maya 2022
tokejepsen Jul 28, 2023
3e6d7c2
Add app_group flag
tokejepsen Jul 28, 2023
8e80c14
Support wildcard "*" app_variant
tokejepsen Jul 28, 2023
fd0774d
Unique databases and output folder per variant
tokejepsen Jul 28, 2023
48a34ba
Support explicit app_variant
tokejepsen Jul 29, 2023
fdb0a4b
Setup only uses test classes properly.
tokejepsen Jul 29, 2023
fb069e6
Run setup_only and testing through same code.
tokejepsen Jul 29, 2023
512a2a6
Code refactor
tokejepsen Jul 30, 2023
e8e3060
Check app error
tokejepsen Jul 30, 2023
04cb04b
Dont support Maya 2020 for now
tokejepsen Jul 30, 2023
4936490
Dump databases without testing.
tokejepsen Jul 31, 2023
6788688
Unzip folders if needed.
tokejepsen Jul 31, 2023
93fc022
Fix missing modules in plugins.
tokejepsen Jul 31, 2023
521faa6
Code cosmetics
tokejepsen Jul 31, 2023
2387814
Initial working Deadline Maya testing
tokejepsen Aug 1, 2023
8174256
Initial working Deadline Maya testing
tokejepsen Aug 1, 2023
1663722
Code refactor
tokejepsen Aug 1, 2023
080fa91
Speed up Deadline testing
tokejepsen Aug 1, 2023
968148d
Speed up Deadline testing
tokejepsen Aug 1, 2023
2ee1c49
Properly forward pyblish errors to stdout
tokejepsen Sep 12, 2023
5fcde4a
Check for OPENPYPE_MONGO flag or environment variable
tokejepsen Sep 12, 2023
b7850ef
Only output errors from publish
tokejepsen Sep 12, 2023
830df68
Always print publish logging
tokejepsen Sep 12, 2023
d07d677
workspace mel with mayapy
tokejepsen Sep 12, 2023
d0ec176
Fix Maya usersetup
tokejepsen Sep 12, 2023
962ed68
Change wildcard
tokejepsen Sep 14, 2023
a651eb5
Code cosmetics
tokejepsen Sep 14, 2023
ca06277
Add MayaPy and 2024
tokejepsen Sep 14, 2023
66784f2
Fix app variants for "all"
tokejepsen Sep 14, 2023
32f1b6a
Fix OpenPype Deadline plugin
tokejepsen Sep 14, 2023
067b835
MayaPy uses maya host
tokejepsen Sep 14, 2023
297a109
Convert Maya scene to 2022
tokejepsen Sep 15, 2023
e03e148
Convert Maya scene to 2022
tokejepsen Sep 15, 2023
d72e8f8
Remove old default Maya versions.
tokejepsen Sep 18, 2023
5e86929
Remove code for Maya 2020
tokejepsen Sep 18, 2023
ec1a740
Fix block comments.
tokejepsen Sep 18, 2023
03a792f
Add info on MayaPy
tokejepsen Sep 19, 2023
f6aaa0c
Remove logs dumps
tokejepsen Sep 19, 2023
d7460aa
Removed logs dumps
tokejepsen Sep 19, 2023
1a2a0f1
Default thumbnails to input resolution
tokejepsen Sep 19, 2023
d98502a
Ingested expected Maya data
tokejepsen Sep 19, 2023
d779797
Ingest expected Maya data
tokejepsen Sep 19, 2023
beb7773
Merge branch 'develop' into enhancement/OP-5060_maya_testing_publish_…
tokejepsen Sep 19, 2023
eca39eb
Fix imports
tokejepsen Sep 19, 2023
d90869b
Fix imports
tokejepsen Sep 19, 2023
fee9d61
Fix tests for latest develop
tokejepsen Sep 19, 2023
f99e0f5
Merge all Maya code to one file.
tokejepsen Sep 19, 2023
e68587a
Ingest expected database
tokejepsen Sep 21, 2023
d57e4ea
Ingest expected database
tokejepsen Sep 21, 2023
b96a993
Remove class_name
tokejepsen Sep 23, 2023
15e82c8
Remove redundant import
tokejepsen Sep 23, 2023
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
60 changes: 52 additions & 8 deletions openpype/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -270,17 +270,32 @@ def run(script):
"--pyargs",
help="Run tests from package",
default=None)
@click.option("--openpype_mongo",
help="MongoDB for testing.",
default=None)
@click.option("-t",
"--test_data_folder",
help="Unzipped directory path of test file",
"--data_folder",
help="Unzipped directory path of test file.",
default=None)
@click.option("--keep_app_open",
help="Keep launched application open for interaction.",
is_flag=True,
default=False)
@click.option("-s",
"--persist",
help="Persist test DB and published files after test end",
is_flag=True,
default=False)
@click.option("--app_group",
help="Optional override of app_group.",
default=None)
@click.option("-a",
"--app_variant",
help="Provide specific app variant for test, empty for latest",
help=(
"Provide specific app variant for test, empty for latest. "
"Supports wildcard \"all\" to test all available app "
"variants."
),
default=None)
@click.option("-t",
"--timeout",
Expand All @@ -289,12 +304,41 @@ def run(script):
@click.option("-so",
"--setup_only",
help="Only create dbs, do not run tests",
default=None)
def runtests(folder, mark, pyargs, test_data_folder, persist, app_variant,
timeout, setup_only):
is_flag=True,
default=False)
@click.option("--dump_databases",
help="Dump all databases to data folder.",
is_flag=True,
default=False)
def runtests(
folder,
mark,
pyargs,
openpype_mongo,
data_folder,
keep_app_open,
persist,
app_group,
app_variant,
timeout,
setup_only,
dump_databases
):
"""Run all automatic tests after proper initialization via start.py"""
PypeCommands().run_tests(folder, mark, pyargs, test_data_folder,
persist, app_variant, timeout, setup_only)
PypeCommands().run_tests(
folder,
mark,
pyargs,
openpype_mongo,
data_folder,
keep_app_open,
persist,
app_group,
app_variant,
timeout,
setup_only,
dump_databases
)


@main.command(help="DEPRECATED - run sync server")
Expand Down
3 changes: 2 additions & 1 deletion openpype/hosts/maya/api/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ def install(self):
self.log.info("Installing callbacks ... ")
register_event_callback("init", on_init)

_set_project()

if lib.IS_HEADLESS:
self.log.info((
"Running in headless mode, skipping Maya save/open/new"
Expand All @@ -105,7 +107,6 @@ def install(self):

return

_set_project()
self._register_callbacks()

menu.install()
Expand Down
2 changes: 1 addition & 1 deletion openpype/hosts/maya/hooks/pre_copy_mel.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class PreCopyMel(PreLaunchHook):

Hook `GlobalHostDataHook` must be executed before this hook.
"""
app_groups = {"maya"}
app_groups = {"maya", "mayapy"}
launch_types = {LaunchTypes.local}

def execute(self):
Expand Down
6 changes: 5 additions & 1 deletion openpype/hosts/maya/plugins/publish/save_scene.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,8 @@ def process(self, context):
if is_workfile_lock_enabled("maya", project_name, project_settings):
remove_workfile_lock(current)
self.log.info("Saving current file: {}".format(current))
cmds.file(save=True, force=True)

# There is a known issue where Maya looses its scene name, so just
# using "save" wont work. Forcing a rename to the current scene name
# covers all cases.
Comment on lines +36 to +38
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we add to the comment when we suspect this to happen - like briefly explain the 'known issue' so we remain aware of when and why.

I believe it occurs when opening a scene that raises errors on scene open, e.g. if the scene uses a plugin you don't have and thus has "unknown nodes".

cmds.file(rename=current)
4 changes: 2 additions & 2 deletions openpype/hosts/maya/startup/userSetup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
from maya import cmds


print("Starting OpenPype usersetup...")

host = MayaHost()
install_host(host)

print("Starting OpenPype usersetup...")

project_name = get_current_project_name()
settings = get_project_settings(project_name)

Expand Down
22 changes: 22 additions & 0 deletions openpype/lib/applications.py
Original file line number Diff line number Diff line change
Expand Up @@ -498,6 +498,19 @@ def find_latest_available_variant_for_group(self, group_name):
break
return output

def find_all_available_variants_for_group(self, group_name):
group = self.app_groups.get(group_name)
if group is None or not group.enabled:
return None

result = []
for _, variant in reversed(sorted(group.variants.items())):
executable = variant.find_executable()
if executable:
result.append(variant)

return result

def create_launch_context(self, app_name, **data):
"""Prepare launch context for application.

Expand Down Expand Up @@ -972,6 +985,9 @@ def __init__(

self.env_group = env_group

stdout = data.pop("stdout", None)
stderr = data.pop("stderr", None)

self.data = dict(data)

launch_args = []
Expand Down Expand Up @@ -1016,6 +1032,12 @@ def __init__(
self.kwargs["stdout"] = subprocess.DEVNULL
self.kwargs["stderr"] = subprocess.DEVNULL

if stdout:
self.kwargs["stdout"] = stdout

if stderr:
self.kwargs["stderr"] = stderr

self.prelaunch_hooks = None
self.postlaunch_hooks = None

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
from datetime import datetime

import requests
import hou

import pyblish.api

Expand Down Expand Up @@ -31,6 +30,7 @@ class HoudiniSubmitPublishDeadline(pyblish.api.ContextPlugin):
targets = ["deadline"]

def process(self, context):
import hou

# Ensure no errors so far
assert all(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import hou

import os
import attr
import getpass
Expand Down Expand Up @@ -117,6 +115,7 @@ def get_job_info(self):
return job_info

def get_plugin_info(self):
import hou

instance = self._instance
context = instance.context
Expand Down
11 changes: 6 additions & 5 deletions openpype/modules/deadline/plugins/publish/submit_max_deadline.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,6 @@
from openpype.pipeline.publish.lib import (
replace_with_published_scene_path
)
from openpype.hosts.max.api.lib import (
get_current_renderer,
get_multipass_setting
)
from openpype.hosts.max.api.lib_rendersettings import RenderSettings
from openpype_modules.deadline import abstract_submit_deadline
from openpype_modules.deadline.abstract_submit_deadline import DeadlineJobInfo
from openpype.lib import is_running_from_build
Expand Down Expand Up @@ -191,6 +186,12 @@ def process_submission(self):
self.submit(self.assemble_payload(job_info, plugin_info))

def _use_published_name(self, data, project_settings):
from openpype.hosts.max.api.lib import (
get_current_renderer,
get_multipass_setting
)
from openpype.hosts.max.api.lib_rendersettings import RenderSettings

instance = self._instance
job_info = copy.deepcopy(self.job_info)
plugin_info = copy.deepcopy(self.plugin_info)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,8 @@ def get_job_info(self):
"AVALON_TASK",
"AVALON_APP_NAME",
"OPENPYPE_DEV"
"IS_TEST"
"IS_TEST",
"AVALON_DB"
]

# Add OpenPype version if we are running from build.
Expand All @@ -231,7 +232,7 @@ def get_job_info(self):
job_info.EnvironmentKeyValue["OPENPYPE_LOG_NO_COLORS"] = "1"

# Adding file dependencies.
if self.asset_dependencies:
if not bool(os.environ.get("IS_TEST")) and self.asset_dependencies:
dependencies = instance.context.data["fileDependencies"]
for dependency in dependencies:
job_info.AssetDependency += dependency
Expand Down Expand Up @@ -571,7 +572,7 @@ def _get_maya_payload(self, data):

job_info = copy.deepcopy(self.job_info)

if self.asset_dependencies:
if not bool(os.environ.get("IS_TEST")) and self.asset_dependencies:
# Asset dependency to wait for at least the scene file to sync.
job_info.AssetDependency += self.scene_path

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
import requests
import pyblish.api

import nuke

from openpype import AYON_SERVER_ENABLED
from openpype.pipeline import legacy_io
from openpype.pipeline.publish import (
Expand Down Expand Up @@ -485,6 +483,8 @@ def get_limit_groups(self):
Returning:
list: captured groups list
"""
import nuke
Copy link
Member

Choose a reason for hiding this comment

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

Why would this be a problem now?


captured_groups = []
for lg_name, list_node_class in self.limit_groups.items():
for node_class in list_node_class:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ class ProcessSubmittedJobOnFarm(pyblish.api.InstancePlugin,
"AVALON_APP_NAME",
"OPENPYPE_USERNAME",
"OPENPYPE_SG_USER",
"AVALON_DB",
"KITSU_LOGIN",
"KITSU_PWD"
]
Expand Down
13 changes: 7 additions & 6 deletions openpype/plugins/publish/collect_otio_frame_ranges.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,8 @@
otioClipRange -> instance data attribute
"""
# import os
import opentimelineio as otio
import pyblish.api
from pprint import pformat
from openpype.pipeline.editorial import (
get_media_range_with_retimes,
otio_range_to_frame_range,
otio_range_with_handles
)


class CollectOtioFrameRanges(pyblish.api.InstancePlugin):
Expand All @@ -27,6 +21,13 @@ class CollectOtioFrameRanges(pyblish.api.InstancePlugin):
hosts = ["resolve", "hiero", "flame", "traypublisher"]

def process(self, instance):
import opentimelineio as otio
from openpype.pipeline.editorial import (
get_media_range_with_retimes,
otio_range_to_frame_range,
otio_range_with_handles
)

# get basic variables
otio_clip = instance.data["otioClip"]
workfile_start = instance.data["workfileFrameStart"]
Expand Down
4 changes: 2 additions & 2 deletions openpype/plugins/publish/collect_otio_review.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
instance -> otioReviewClips
instance -> families (adding ["review", "ftrack"])
"""

import opentimelineio as otio
import pyblish.api
from pprint import pformat

Expand All @@ -25,6 +23,8 @@ class CollectOtioReview(pyblish.api.InstancePlugin):
hosts = ["resolve", "hiero", "flame"]

def process(self, instance):
import opentimelineio as otio

# get basic variables
otio_review_clips = []
otio_timeline = instance.context.data["otioTimeline"]
Expand Down
14 changes: 7 additions & 7 deletions openpype/plugins/publish/collect_otio_subset_resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,12 @@
"""
import os
import clique
import opentimelineio as otio
import pyblish.api
from openpype.pipeline.editorial import (
get_media_range_with_retimes,
range_from_frames,
make_sequence_collection
)
from openpype.pipeline.publish import (
get_publish_template_name
)


class CollectOtioSubsetResources(pyblish.api.InstancePlugin):
"""Get Resources for a subset version"""

Expand All @@ -26,8 +21,13 @@ class CollectOtioSubsetResources(pyblish.api.InstancePlugin):
families = ["clip"]
hosts = ["resolve", "hiero", "flame"]


def process(self, instance):
import opentimelineio as otio
from openpype.pipeline.editorial import (
get_media_range_with_retimes,
range_from_frames,
make_sequence_collection
)

if "audio" in instance.data["family"]:
return
Expand Down
3 changes: 2 additions & 1 deletion openpype/plugins/publish/extract_otio_audio_tracks.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
run_subprocess
)
import tempfile
import opentimelineio as otio


class ExtractOtioAudioTracks(pyblish.api.ContextPlugin):
Expand Down Expand Up @@ -155,6 +154,8 @@ def get_audio_track_items(self, otio_timeline):
Returns:
list: list of audio clip dictionaries
"""
import opentimelineio as otio

output = []
# go trough all audio tracks
for otio_track in otio_timeline.tracks:
Expand Down
3 changes: 2 additions & 1 deletion openpype/plugins/publish/extract_otio_file.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import os
import pyblish.api
import opentimelineio as otio

from openpype.pipeline import publish

Expand All @@ -16,6 +15,8 @@ class ExtractOTIOFile(publish.Extractor):
hosts = ["resolve", "hiero", "traypublisher"]

def process(self, instance):
import opentimelineio as otio

if not instance.context.data.get("otioTimeline"):
return
# create representation data
Expand Down
Loading
Loading