From ceeaf28dd7e461cd2271796092651b014f6c6f8f Mon Sep 17 00:00:00 2001 From: Petr Kalis Date: Fri, 3 Dec 2021 10:14:14 +0100 Subject: [PATCH] OP-2042 - clean up files from different PR --- .../aftereffects/plugins/publish/closeAE.py | 29 ------ .../plugins/publish/extract_local_render.py | 3 +- openpype/lib/remote_publish.py | 46 --------- .../system_settings/applications.json | 17 ---- .../test_publish_in_aftereffects.py | 96 ------------------- 5 files changed, 2 insertions(+), 189 deletions(-) delete mode 100644 openpype/hosts/aftereffects/plugins/publish/closeAE.py delete mode 100644 tests/integration/hosts/aftereffects/test_publish_in_aftereffects.py diff --git a/openpype/hosts/aftereffects/plugins/publish/closeAE.py b/openpype/hosts/aftereffects/plugins/publish/closeAE.py deleted file mode 100644 index e6e9623474..0000000000 --- a/openpype/hosts/aftereffects/plugins/publish/closeAE.py +++ /dev/null @@ -1,29 +0,0 @@ -# -*- coding: utf-8 -*- -"""Close AE after publish. For Webpublishing only.""" -import os - -import pyblish.api - -from avalon import aftereffects - - -class CloseAE(pyblish.api.ContextPlugin): - """Close AE after publish. For Webpublishing only. - """ - - order = pyblish.api.IntegratorOrder + 14 - label = "Close AE" - optional = True - active = True - - hosts = ["aftereffects"] - targets = ["remotepublish"] - - def process(self, context): - self.log.info("CloseAE") - - stub = aftereffects.stub() - self.log.info("Shutting down AE") - stub.save() - stub.close() - self.log.info("AE closed") diff --git a/openpype/hosts/aftereffects/plugins/publish/extract_local_render.py b/openpype/hosts/aftereffects/plugins/publish/extract_local_render.py index b36ab24bde..37337e7fee 100644 --- a/openpype/hosts/aftereffects/plugins/publish/extract_local_render.py +++ b/openpype/hosts/aftereffects/plugins/publish/extract_local_render.py @@ -19,9 +19,10 @@ class ExtractLocalRender(openpype.api.Extractor): staging_dir = instance.data["stagingDir"] self.log.info("staging_dir::{}".format(staging_dir)) + stub.render(staging_dir) + # pull file name from Render Queue Output module render_q = stub.get_render_info() - stub.render(staging_dir) if not render_q: raise ValueError("No file extension set in Render Queue") _, ext = os.path.splitext(os.path.basename(render_q.file_name)) diff --git a/openpype/lib/remote_publish.py b/openpype/lib/remote_publish.py index 6c594b50e8..d7db4d1ab9 100644 --- a/openpype/lib/remote_publish.py +++ b/openpype/lib/remote_publish.py @@ -11,25 +11,6 @@ from openpype.lib.mongo import OpenPypeMongoConnection from openpype.lib.plugin_tools import parse_json -def headless_publish(log, close_plugin_name=None, is_test=False): - """Runs publish in a opened host with a context and closes Python process. - - Host is being closed via ClosePS pyblish plugin which triggers 'exit' - method in ConsoleTrayApp. - """ - if not is_test: - dbcon = get_webpublish_conn() - _id = os.environ.get("BATCH_LOG_ID") - if not _id: - log.warning("Unable to store log records, " - "batch will be unfinished!") - return - - publish_and_log(dbcon, _id, log, close_plugin_name) - else: - publish(log, close_plugin_name) - - def get_webpublish_conn(): """Get connection to OP 'webpublishes' collection.""" mongo_client = OpenPypeMongoConnection.get_mongo_client() @@ -56,33 +37,6 @@ def start_webpublish_log(dbcon, batch_id, user): }).inserted_id -def publish(log, close_plugin_name=None): - """Loops through all plugins, logs to console. Used for tests. - - Args: - log (OpenPypeLogger) - close_plugin_name (str): name of plugin with responsibility to - close host app - """ - # Error exit as soon as any error occurs. - error_format = "Failed {plugin.__name__}: {error} -- {error.traceback}" - - close_plugin = _get_close_plugin(close_plugin_name, log) - - for result in pyblish.util.publish_iter(): - for record in result["records"]: - log.info("{}: {}".format( - result["plugin"].label, record.msg)) - - if result["error"]: - log.error(error_format.format(**result)) - uninstall() - if close_plugin: # close host app explicitly after error - context = pyblish.api.Context() - close_plugin().process(context) - sys.exit(1) - - def publish_and_log(dbcon, _id, log, close_plugin_name=None): """Loops through all plugins, logs ok and fails into OP DB. diff --git a/openpype/settings/defaults/system_settings/applications.json b/openpype/settings/defaults/system_settings/applications.json index 4e50201036..c730e02984 100644 --- a/openpype/settings/defaults/system_settings/applications.json +++ b/openpype/settings/defaults/system_settings/applications.json @@ -1098,23 +1098,6 @@ "linux": [] }, "environment": {} - }, - "2022": { - "enabled": true, - "variant_label": "2022", - "executables": { - "windows": [ - "C:\\Program Files\\Adobe\\Adobe After Effects 2022\\Support Files\\AfterFX.exe" - ], - "darwin": [], - "linux": [] - }, - "arguments": { - "windows": [], - "darwin": [], - "linux": [] - }, - "environment": {} } } }, diff --git a/tests/integration/hosts/aftereffects/test_publish_in_aftereffects.py b/tests/integration/hosts/aftereffects/test_publish_in_aftereffects.py deleted file mode 100644 index d4e88dfd4c..0000000000 --- a/tests/integration/hosts/aftereffects/test_publish_in_aftereffects.py +++ /dev/null @@ -1,96 +0,0 @@ -import pytest -import os -import shutil - -from tests.lib.testing_classes import PublishTest - - -class TestPublishInAfterEffects(PublishTest): - """Basic test case for publishing in AfterEffects - - Uses generic TestCase to prepare fixtures for test data, testing DBs, - env vars. - - Opens AfterEffects, run publish on prepared workile. - - Then checks content of DB (if subset, version, representations were - created. - Checks tmp folder if all expected files were published. - - """ - PERSIST = True - - TEST_FILES = [ - ("1qsrq6OJWVpOeXE2LTWrdbsLqEVu155Uf", - "test_aftereffects_publish.zip", - "") - ] - - APP = "aftereffects" - APP_VARIANT = "2021" - - APP_NAME = "{}/{}".format(APP, APP_VARIANT) - - TIMEOUT = 120 # publish timeout - - @pytest.fixture(scope="module") - def last_workfile_path(self, download_test_data): - """Get last_workfile_path from source data. - - Maya expects workfile in proper folder, so copy is done first. - """ - src_path = os.path.join(download_test_data, - "input", - "workfile", - "test_project_test_asset_TestTask_v001.aep") - dest_folder = os.path.join(download_test_data, - self.PROJECT, - self.ASSET, - "work", - self.TASK) - os.makedirs(dest_folder) - dest_path = os.path.join(dest_folder, - "test_project_test_asset_TestTask_v001.aep") - shutil.copy(src_path, dest_path) - - yield dest_path - - @pytest.fixture(scope="module") - def startup_scripts(self, monkeypatch_session, download_test_data): - """Points AfterEffects to userSetup file from input data""" - pass - - def test_db_asserts(self, dbcon, publish_finished): - """Host and input data dependent expected results in DB.""" - print("test_db_asserts") - assert 5 == dbcon.count_documents({"type": "version"}), \ - "Not expected no of versions" - - assert 0 == dbcon.count_documents({"type": "version", - "name": {"$ne": 1}}), \ - "Only versions with 1 expected" - - assert 1 == dbcon.count_documents({"type": "subset", - "name": "modelMain"}), \ - "modelMain subset must be present" - - assert 1 == dbcon.count_documents({"type": "subset", - "name": "workfileTest_task"}), \ - "workfileTest_task subset must be present" - - assert 11 == dbcon.count_documents({"type": "representation"}), \ - "Not expected no of representations" - - assert 2 == dbcon.count_documents({"type": "representation", - "context.subset": "modelMain", - "context.ext": "abc"}), \ - "Not expected no of representations with ext 'abc'" - - assert 2 == dbcon.count_documents({"type": "representation", - "context.subset": "modelMain", - "context.ext": "ma"}), \ - "Not expected no of representations with ext 'abc'" - - -if __name__ == "__main__": - test_case = TestPublishInAfterEffects()