Skip to content

Commit

Permalink
Merge pull request #108 from ynput/bugfix/change_outputdir
Browse files Browse the repository at this point in the history
Job Info Output Directory+Files pass sequence and remap to published workfile if needed
  • Loading branch information
kalisp authored Jan 22, 2025
2 parents 337c0a6 + e94e50b commit 7749e09
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 11 deletions.
32 changes: 27 additions & 5 deletions client/ayon_deadline/abstract_submit_deadline.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from datetime import datetime
from copy import deepcopy
from typing import Optional
import clique

import requests
import pyblish.api
Expand Down Expand Up @@ -108,6 +109,10 @@ def process(self, instance):
context.data["currentFile"],
job_info.use_published
)
self._append_job_output_paths(
instance,
self.job_info
)
self.plugin_info = self.get_plugin_info()

self.aux_files = self.get_aux_files()
Expand Down Expand Up @@ -157,6 +162,28 @@ def _set_scene_path(self, current_file, use_published):
self.scene_path = file_path
self.log.info("Using {} for render/export.".format(file_path))

def _append_job_output_paths(self, instance, job_info):
"""Set output part to Job info
Note: 'expectedFiles' might be remapped after `_set_scene_path`
due to remapping workfile to published workfile.
Used in JobOutput > Explore output
"""
collections, remainder = clique.assemble(
iter_expected_files(instance.data["expectedFiles"]),
assume_padded_when_ambiguous=True,
patterns=[clique.PATTERNS["frames"]])
paths = []
for collection in collections:
padding = "#" * collection.padding
path = collection.format(f"{{head}}{padding}{{tail}}")
paths.append(path)
paths.extend(remainder)

for path in paths:
job_info.OutputDirectory += os.path.dirname(path)
job_info.OutputFilename += os.path.basename(path)

def process_submission(self):
"""Process data for submission.
Expand Down Expand Up @@ -195,11 +222,6 @@ def get_generic_job_info(self, instance: pyblish.api.Instance):
if job_info.SecondaryPool != "none":
job_info.SecondaryPool = job_info.SecondaryPool

exp = instance.data.get("expectedFiles")
for filepath in iter_expected_files(exp):
job_info.OutputDirectory += os.path.dirname(filepath)
job_info.OutputFilename += os.path.basename(filepath)

# Adding file dependencies.
if not is_in_tests() and job_info.use_asset_dependencies:
dependencies = instance.context.data.get("fileDependencies", [])
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import os
from dataclasses import dataclass, field, asdict

import pyblish.api

from ayon_core.pipeline.publish import AYONPyblishPluginMixin
from ayon_core.pipeline.farm.tools import iter_expected_files
from ayon_deadline import abstract_submit_deadline


Expand Down Expand Up @@ -110,10 +109,7 @@ def get_job_info(self, job_info=None, **kwargs):
if saver_instance is instance:
continue

exp = instance.data.get("expectedFiles")
for filepath in iter_expected_files(exp):
job_info.OutputDirectory += os.path.dirname(filepath)
job_info.OutputFilename += os.path.basename(filepath)
self._append_job_output_paths(instance, job_info)

return job_info

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,11 @@ def process(self, instance):
self._set_scene_path(
context.data["currentFile"], job_info.use_published)

self._append_job_output_paths(
instance,
self.job_info
)

self.plugin_info = self.get_plugin_info(
scene_path=self.scene_path,
render_path=render_path,
Expand Down

0 comments on commit 7749e09

Please sign in to comment.