Skip to content
This repository has been archived by the owner on Sep 20, 2024. It is now read-only.

Tests: add support for deadline for automatic tests #3989

Merged
Show file tree
Hide file tree
Changes from 91 commits
Commits
Show all changes
81 commits
Select commit Hold shift + click to select a range
e3864ea
OP-3426 - DL support for Maya automatic tests
kalisp Oct 14, 2022
5ee97fa
OP-3426 - DL support for AE automatic tests
kalisp Oct 14, 2022
be51b3d
OP-3426 - fix not dropping settings collection
kalisp Oct 14, 2022
d5e6203
OP-3426 - wait for DL publish job
kalisp Oct 14, 2022
abe5e24
OP-3426 - fix check if job is finished
kalisp Oct 17, 2022
646dcd9
OP-3426 - fix proper zip id for deadline test
kalisp Oct 17, 2022
a45218d
OP-3426 - fix proper id for publish job
kalisp Oct 17, 2022
6f5c91c
OP-3426 - refactor - Nuke to new testing classes
kalisp Oct 17, 2022
fdaa777
OP-3426 - added new Nuke deadline testing class
kalisp Oct 17, 2022
9159b67
OP-3426 - fix source zip file for Nuke
kalisp Oct 17, 2022
8b29406
OP-3426 - cleaned up test_projece DB dump
kalisp Oct 18, 2022
7c90486
OP-3426 - test class for Maya and Deadline
kalisp Oct 18, 2022
2436fab
OP-3426 - update db asserts for simple Maya test
kalisp Oct 18, 2022
eb772dd
OP-3426 - update db asserts for PS
kalisp Oct 18, 2022
c27d8a2
OP-3426 - refactor - changed style of db asserts for Maya
kalisp Oct 18, 2022
0056be4
OP-3426 - fix - wrong testing class used
kalisp Oct 18, 2022
b98e037
OP-4180 - renamed DL testing class for Nuke
kalisp Oct 19, 2022
29ca3f8
OP-4180 - change output folder
kalisp Oct 19, 2022
76de4e4
OP-3426 - added support for automatic tests into GlobalJobPreLoad
kalisp Oct 19, 2022
5a885ac
OP-3426 - changed source DBs
kalisp Oct 19, 2022
fde0a02
OP-3426 - add automatic_tests argument to cli for extractenvironments
kalisp Oct 19, 2022
8f3b6e5
OP-3426 - don't remove from sys.args
kalisp Oct 19, 2022
f501c63
OP-3426 - propagate automatic_tests for publish process on DL
kalisp Oct 19, 2022
b996aca
OP-3426 - disable unwanted commands
kalisp Oct 19, 2022
e9dfcf6
OP-3426 - added date string to batch name
kalisp Oct 19, 2022
d6bbc95
OP-3426 - fix - wrong format of args
kalisp Oct 19, 2022
f474034
OP-3426 - update CleanUp to skip for automatic tests
kalisp Oct 19, 2022
ec01973
Merge branch 'develop' of github.com:pypeclub/OpenPype into feature/O…
kalisp Oct 19, 2022
7e6c355
OP-3426 - purge temp only if not error
kalisp Oct 20, 2022
5d9aaec
OP-3426 - fix output folder
kalisp Oct 21, 2022
e38ae9d
OP-3426 - refactor - rename workfile
kalisp Oct 21, 2022
127a0dc
OP-3426 - refactor - use class variable
kalisp Oct 21, 2022
f703e53
OP-3426 - fix - wrong flag used in pype_commands
kalisp Oct 24, 2022
d35ea96
OP-3426 - added filtering of published folders from comparing
kalisp Oct 24, 2022
e94c524
OP-3426 - fix - counts of expected items in DB
kalisp Oct 24, 2022
1f18639
OP-3426 - fix - counts of expected items in DB
kalisp Oct 24, 2022
22a86f8
OP-3426 - updated PS testing class
kalisp Oct 24, 2022
f733305
OP-3426 - filter out Auto-Save folder
kalisp Oct 25, 2022
dab37ab
OP-3426 - updated filtering logic
kalisp Oct 25, 2022
2ed190c
OP-3426 - remove unwanted uncommenting
kalisp Oct 25, 2022
c68f5f4
OP-3426 - Hound
kalisp Oct 25, 2022
aeab0c3
Merge branch 'develop' of github.com:pypeclub/OpenPype into feature/O…
kalisp Oct 26, 2022
2880e93
Merge branch 'develop' of github.com:pypeclub/OpenPype into feature/O…
kalisp Oct 26, 2022
b528d23
Merge branch 'develop' of github.com:pypeclub/OpenPype into feature/O…
kalisp Oct 27, 2022
9192005
OP-3426 - increase timeout for Nuke
kalisp Oct 27, 2022
381ea92
OP-3426 - fix subset name in Nuke
kalisp Oct 27, 2022
b0f0644
OP-3426 - updated skeleton source zip file
kalisp Nov 3, 2022
9ab5588
Merge branch 'develop' of github.com:pypeclub/OpenPype into feature/O…
kalisp Nov 3, 2022
460ae13
Merge remote-tracking branch 'origin/release/3.15.x' into feature/OP-…
kalisp Nov 3, 2022
5c34fcb
OP-3426 - added requirements for mongodump in readme
kalisp Nov 4, 2022
8aa0519
OP-3426 - fix wrong command in web docs
kalisp Nov 4, 2022
fc99a9a
OP-3426 - raise better exception if mongorestore not found
kalisp Nov 4, 2022
4a4726f
OP-3426 - add more details to web documentation
kalisp Nov 4, 2022
350685b
OP-3426 - changed APP to APP_GROUP
kalisp Nov 4, 2022
90bc39b
Merge branch 'develop' of github.com:pypeclub/OpenPype into feature/O…
kalisp Nov 7, 2022
058d401
OP-3426 - refactor - cleaned up cli arguments
kalisp Nov 7, 2022
66bea60
OP-3426 - refactor - replaced check of env var with function
kalisp Nov 7, 2022
d395118
OP-3426 - fix - wrong function signature
kalisp Nov 7, 2022
23c70e3
OP-3426 - fix - wrong function signature
kalisp Nov 7, 2022
418135c
Merge remote-tracking branch 'origin/release/3.15.x' into feature/OP-…
kalisp Nov 7, 2022
d3769b3
OP-3426 - fix - add _tests suffix only if not present
kalisp Nov 7, 2022
e5a604d
OP-3426 - fix - failed class variable wasn't changed
kalisp Nov 7, 2022
12ef735
OP-3426 - fix - function must be called
kalisp Nov 7, 2022
b3c79c4
OP-3426 - fix - use failed as class variable
kalisp Nov 8, 2022
7b10f4d
OP-3426 - fix - create context if not injected
kalisp Nov 8, 2022
1114c86
Merge branch 'develop' of github.com:pypeclub/OpenPype into feature/O…
kalisp Nov 11, 2022
81a3cba
OP-4361 - cleaned up AE tests
kalisp Nov 11, 2022
130e00e
OP-3426 - fix files filtering
kalisp Nov 11, 2022
a48c76b
OP-3426 - set failed when assertion error
kalisp Nov 11, 2022
51db293
OP-3426 - allow multiple render deadline jobs
kalisp Nov 11, 2022
0c9c9c4
OP-3426 - remove not working set of failed
kalisp Nov 11, 2022
de2bd09
OP-3426 - remove failed class variable
kalisp Nov 11, 2022
40d2571
OP-3426 - added test job for multi composition in AE in DL
kalisp Nov 11, 2022
41f4c39
Merge branch 'release/3.15.x' into feature/OP-3426_Add-support-for-De…
kalisp Nov 11, 2022
7f166dd
OP-3426 - fix AE tests
kalisp Nov 14, 2022
11516f5
Merge branch 'develop' of github.com:pypeclub/OpenPype into feature/O…
kalisp Nov 14, 2022
2dfb34b
Merge remote-tracking branch 'origin/feature/OP-3426_Add-support-for-…
kalisp Nov 14, 2022
a20c102
OP-3426 - fix check for failed test
kalisp Nov 21, 2022
bd5e828
OP-3426 - added legacy publish in AE
kalisp Nov 21, 2022
02b7c64
OP-3426 - fix expected count of representation
kalisp Nov 21, 2022
7959bfb
Merge branch 'release/3.15.x' into feature/OP-3426_Add-support-for-De…
kalisp Dec 2, 2022
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: 4 additions & 1 deletion igniter/bootstrap_repos.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ class OpenPypeVersion(semver.VersionInfo):

"""
path = None
_VERSION_REGEX = re.compile(r"(?P<major>0|[1-9]\d*)\.(?P<minor>0|[1-9]\d*)\.(?P<patch>0|[1-9]\d*)(?:-(?P<prerelease>(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+(?P<buildmetadata>[0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?") # noqa: E501
# this should match any string complying with https://semver.org/
_VERSION_REGEX = re.compile(r"(?P<major>0|[1-9]\d*)\.(?P<minor>0|[1-9]\d*)\.(?P<patch>0|[1-9]\d*)(?:-(?P<prerelease>[a-zA-Z\d\-.]*))?(?:\+(?P<buildmetadata>[a-zA-Z\d\-.]*))?") # noqa: E501
_installed_version = None

def __init__(self, *args, **kwargs):
Expand Down Expand Up @@ -154,6 +155,8 @@ def version_in_str(string: str) -> Union[None, OpenPypeVersion]:
OpenPypeVersion: of detected or None.

"""
# strip .zip ext if present
string = re.sub(r"\.zip$", "", string, flags=re.IGNORECASE)
m = re.search(OpenPypeVersion._VERSION_REGEX, string)
if not m:
return None
Expand Down
3 changes: 2 additions & 1 deletion igniter/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,8 @@ def get_openpype_global_settings(url: str) -> dict:
# Create mongo connection
client = MongoClient(url, **kwargs)
# Access settings collection
col = client["openpype"]["settings"]
openpype_db = os.environ.get("OPENPYPE_DATABASE_NAME") or "openpype"
col = client[openpype_db]["settings"]
# Query global settings
global_settings = col.find_one({"type": "global_settings"}) or {}
# Close Mongo connection
Expand Down
4 changes: 3 additions & 1 deletion openpype/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@
@click.option("--debug", is_flag=True, expose_value=False,
help="Enable debug")
@click.option("--verbose", expose_value=False,
help="Change OpenPype log level (debug - critical or 0-50)")
help=("Change OpenPype log level (debug - critical or 0-50)"))
@click.option("--automatic-tests", is_flag=True, expose_value=False,
help=("Run in automatic tests mode"))
def main(ctx):
"""Pype is main command serving as entry point to pipeline system.

Expand Down
3 changes: 2 additions & 1 deletion openpype/hosts/aftereffects/api/lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
from openpype.modules import ModulesManager

from openpype.tools.utils import host_tools
from openpype.tests.lib import is_in_tests
from .launch_logic import ProcessLauncher, get_stub

log = logging.getLogger(__name__)
Expand Down Expand Up @@ -47,7 +48,7 @@ def main(*subprocess_args):
webpublisher_addon.headless_publish,
log,
"CloseAE",
os.environ.get("IS_TEST")
is_in_tests()
)
)

Expand Down
2 changes: 2 additions & 0 deletions openpype/hosts/nuke/api/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -427,6 +427,8 @@ def save_file(self):
# create nk path
path = os.path.splitext(self.path)[0] + ".nk"
# save file to the path
if not os.path.exists(os.path.dirname(path)):
os.makedirs(os.path.dirname(path))
shutil.copyfile(self.instance.context.data["currentFile"], path)

self.log.info("Nodes exported...")
Expand Down
3 changes: 2 additions & 1 deletion openpype/hosts/photoshop/api/lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from openpype.modules import ModulesManager
from openpype.pipeline import install_host
from openpype.tools.utils import host_tools
from openpype.tests.lib import is_in_tests

from .launch_logic import ProcessLauncher, stub

Expand Down Expand Up @@ -42,7 +43,7 @@ def main(*subprocess_args):
webpublisher_addon.headless_publish,
log,
"ClosePS",
os.environ.get("IS_TEST")
is_in_tests()
)
elif env_value_to_bool("AVALON_PHOTOSHOP_WORKFILES_ON_LAUNCH",
default=True):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
get_batch_asset_task_info,
parse_json
)
from openpype.tests.lib import is_in_tests


class CollectBatchData(pyblish.api.ContextPlugin):
Expand All @@ -39,7 +40,7 @@ class CollectBatchData(pyblish.api.ContextPlugin):
def process(self, context):
self.log.info("CollectBatchData")
batch_dir = os.environ.get("OPENPYPE_PUBLISH_DATA")
if os.environ.get("IS_TEST"):
if is_in_tests():
self.log.debug("Automatic testing, no batch data, skipping")
return

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from openpype.lib import prepare_template_data
from openpype.hosts.photoshop import api as photoshop
from openpype.settings import get_project_settings
from openpype.tests.lib import is_in_tests


class CollectColorCodedInstances(pyblish.api.ContextPlugin):
Expand Down Expand Up @@ -46,7 +47,7 @@ class CollectColorCodedInstances(pyblish.api.ContextPlugin):
def process(self, context):
self.log.info("CollectColorCodedInstances")
batch_dir = os.environ.get("OPENPYPE_PUBLISH_DATA")
if (os.environ.get("IS_TEST") and
if (is_in_tests() and
(not batch_dir or not os.path.exists(batch_dir))):
self.log.debug("Automatic testing, no batch data, skipping")
return
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class CollectOutputFrameRange(pyblish.api.ContextPlugin):

When instances are collected context does not contain `frameStart` and
`frameEnd` keys yet. They are collected in global plugin
`CollectAvalonEntities`.
`CollectContextEntities`.
"""
label = "Collect output frame range"
order = pyblish.api.CollectorOrder
Expand Down
2 changes: 1 addition & 1 deletion openpype/hosts/tvpaint/plugins/publish/validate_marks.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class ValidateMarks(pyblish.api.ContextPlugin):
def get_expected_data(context):
scene_mark_in = context.data["sceneMarkIn"]

# Data collected in `CollectAvalonEntities`
# Data collected in `CollectContextEntities`
frame_end = context.data["frameEnd"]
frame_start = context.data["frameStart"]
handle_start = context.data["handleStart"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class ValidateWorkfileData(pyblish.api.ContextPlugin):
targets = ["tvpaint_worker"]

def process(self, context):
# Data collected in `CollectAvalonEntities`
# Data collected in `CollectContextEntities`
frame_start = context.data["frameStart"]
frame_end = context.data["frameEnd"]
handle_start = context.data["handleStart"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import attr
import getpass
import pyblish.api
from datetime import datetime

from openpype.lib import (
env_value_to_bool,
Expand All @@ -10,6 +11,7 @@
from openpype.pipeline import legacy_io
from openpype_modules.deadline import abstract_submit_deadline
from openpype_modules.deadline.abstract_submit_deadline import DeadlineJobInfo
from openpype.tests.lib import is_in_tests


@attr.s
Expand Down Expand Up @@ -48,9 +50,11 @@ def get_job_info(self):

context = self._instance.context

batch_name = os.path.basename(self._instance.data["source"])
if is_in_tests():
batch_name += datetime.now().strftime("%d%m%Y%H%M%S")
dln_job_info.Name = self._instance.data["name"]
dln_job_info.BatchName = os.path.basename(self._instance.
data["source"])
dln_job_info.BatchName = batch_name
dln_job_info.Plugin = "AfterEffects"
dln_job_info.UserName = context.data.get(
"deadlineUser", getpass.getuser())
Expand Down Expand Up @@ -83,7 +87,8 @@ def get_job_info(self):
"AVALON_APP_NAME",
"OPENPYPE_DEV",
"OPENPYPE_LOG_NO_COLORS",
"OPENPYPE_VERSION"
"OPENPYPE_VERSION",
"IS_TEST"
]
# Add mongo url if it's enabled
if self._instance.context.data.get("deadlinePassMongoUrl"):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@
from collections import OrderedDict
from zipfile import ZipFile, is_zipfile
import re
from datetime import datetime

import attr
import pyblish.api

from openpype.pipeline import legacy_io
from openpype_modules.deadline import abstract_submit_deadline
from openpype_modules.deadline.abstract_submit_deadline import DeadlineJobInfo
from openpype.tests.lib import is_in_tests


class _ZipFile(ZipFile):
Expand Down Expand Up @@ -261,7 +263,10 @@ def get_job_info(self):
job_info.Pool = self._instance.data.get("primaryPool")
job_info.SecondaryPool = self._instance.data.get("secondaryPool")
job_info.ChunkSize = self.chunk_size
job_info.BatchName = os.path.basename(self._instance.data["source"])
batch_name = os.path.basename(self._instance.data["source"])
if is_in_tests:
batch_name += datetime.now().strftime("%d%m%Y%H%M%S")
job_info.BatchName = batch_name
job_info.Department = self.department
job_info.Group = self.group

Expand All @@ -275,7 +280,8 @@ def get_job_info(self):
"AVALON_APP_NAME",
"OPENPYPE_DEV",
"OPENPYPE_LOG_NO_COLORS",
"OPENPYPE_VERSION"
"OPENPYPE_VERSION",
"IS_TEST"
]
# Add mongo url if it's enabled
if self._instance.context.data.get("deadlinePassMongoUrl"):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import os
import json
from datetime import datetime

import requests
import hou

import pyblish.api

from openpype.pipeline import legacy_io
from openpype.tests.lib import is_in_tests


class HoudiniSubmitPublishDeadline(pyblish.api.ContextPlugin):
Expand Down Expand Up @@ -60,6 +62,8 @@ def process(self, context):

job_name = "{scene} [PUBLISH]".format(scene=scenename)
batch_name = "{code} - {scene}".format(code=code, scene=scenename)
if is_in_tests():
batch_name += datetime.now().strftime("%d%m%Y%H%M%S")
deadline_user = "roy" # todo: get deadline user dynamically

# Get only major.minor version of Houdini, ignore patch version
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
import os
import json
import getpass
from datetime import datetime

import requests
import pyblish.api

# import hou ???

from openpype.pipeline import legacy_io
from openpype.tests.lib import is_in_tests


class HoudiniSubmitRenderDeadline(pyblish.api.InstancePlugin):
Expand Down Expand Up @@ -45,6 +47,9 @@ def process(self, instance):
if code:
batch_name = "{0} - {1}".format(code, batch_name)

if is_in_tests():
batch_name += datetime.now().strftime("%d%m%Y%H%M%S")

# Output driver to render
driver = instance[0]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@

from openpype_modules.deadline import abstract_submit_deadline
from openpype_modules.deadline.abstract_submit_deadline import DeadlineJobInfo
from openpype.tests.lib import is_in_tests


def _validate_deadline_bool_value(instance, attribute, value):
Expand Down Expand Up @@ -121,6 +122,9 @@ def get_job_info(self):
src_filepath = context.data["currentFile"]
src_filename = os.path.basename(src_filepath)

if is_in_tests():
src_filename += datetime.now().strftime("%d%m%Y%H%M%S")

job_info.Name = "%s - %s" % (src_filename, instance.name)
job_info.BatchName = src_filename
job_info.Plugin = instance.data.get("mayaRenderPlugin", "MayaBatch")
Expand Down Expand Up @@ -161,7 +165,8 @@ def get_job_info(self):
"AVALON_TASK",
"AVALON_APP_NAME",
"OPENPYPE_DEV",
"OPENPYPE_VERSION"
"OPENPYPE_VERSION",
"IS_TEST"
]
# Add mongo url if it's enabled
if self._instance.context.data.get("deadlinePassMongoUrl"):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import os
import requests
from datetime import datetime

from maya import cmds

from openpype.pipeline import legacy_io, PublishXmlValidationError
from openpype.settings import get_project_settings
from openpype.tests.lib import is_in_tests

import pyblish.api

Expand Down Expand Up @@ -57,6 +59,8 @@ def process(self, instance):
job_name = "{scene} [PUBLISH]".format(scene=scenename)
batch_name = "{code} - {scene}".format(code=project_name,
scene=scenename)
if is_in_tests():
batch_name += datetime.now().strftime("%d%m%Y%H%M%S")

# Generate the payload for Deadline submission
payload = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@
import re
import json
import getpass
from datetime import datetime

import requests
import pyblish.api

import nuke
from openpype.pipeline import legacy_io
from openpype.tests.lib import is_in_tests


class NukeSubmitDeadline(pyblish.api.InstancePlugin):
Expand Down Expand Up @@ -141,8 +143,11 @@ def payload_submit(
responce_data=None
):
render_dir = os.path.normpath(os.path.dirname(render_path))
script_name = os.path.basename(script_path)
jobname = "%s - %s" % (script_name, instance.name)
batch_name = os.path.basename(script_path)
jobname = "%s - %s" % (batch_name, instance.name)
if is_in_tests():
batch_name += datetime.now().strftime("%d%m%Y%H%M%S")


output_filename_0 = self.preview_fname(render_path)

Expand Down Expand Up @@ -176,7 +181,7 @@ def payload_submit(
payload = {
"JobInfo": {
# Top-level group name
"BatchName": script_name,
"BatchName": batch_name,

# Asset dependency to wait for at least the scene file to sync.
# "AssetDependency0": script_path,
Expand Down
Loading