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

Enhancement: Some publish logs cosmetics #5917

Merged
merged 7 commits into from
Nov 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ def _remove_container(self, container):

if pop_idx is None:
self.log.warning(
"Didn't found container in workfile containers. {}".format(
"Didn't find container in workfile containers. {}".format(
container
)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def _selection_interface(self, session, event_values=None):
"items": [{
"type": "label",
"value": (
"Didn't found custom attributes"
"Didn't find custom attributes"
" that can be transferred."
)
}]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ def set_next_task_statuses(
new_task_name = mapping.get(old_status_name)
if not new_task_name:
self.log.debug(
"Didn't found mapping for status \"{}\".".format(
"Didn't find mapping for status \"{}\".".format(
task_status["name"]
)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ def get_found_data(entity):
if not data:
# TODO logging
self.log.warning(
"Didn't found entity by key/value \"{}\" / \"{}\"".format(
"Didn't find entity by key/value \"{}\" / \"{}\"".format(
key, value
)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def launch(self, session, entities, event):
else:
return {
'success': False,
'message': "Didn't found file: " + fpath
'message': "Didn't find file: " + fpath
}

return {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ def interface(self, session, entities, event):
return {
"success": True,
"message": (
"Didn't found entities in avalon."
"Didn't find entities in avalon."
" You can use Ftrack's Delete button for the selection."
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def interface(self, session, entities, event):
return {
"success": False,
"message": (
"Didn't found project \"{}\" in avalon."
"Didn't find project \"{}\" in avalon."
).format(project_name)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def interface(self, session, entities, event):
if not jobs:
return {
"success": True,
"message": "Didn't found any running jobs"
"message": "Didn't find any running jobs"
}

# Collect user ids from jobs
Expand Down
26 changes: 15 additions & 11 deletions openpype/plugins/publish/cleanup_explicit.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,21 +58,21 @@ def _remove_full_paths(self, full_paths):
# Store failed paths with exception
failed = []
# Store removed filepaths for logging
succeded_files = set()
succeeded_files = set()
# Remove file by file
for filepath in filepaths:
try:
os.remove(filepath)
succeded_files.add(filepath)
succeeded_files.add(filepath)
except Exception as exc:
failed.append((filepath, exc))

if succeded_files:
if succeeded_files:
self.log.info(
"Removed files:\n{}".format("\n".join(succeded_files))
"Removed files:\n{}".format("\n".join(sorted(succeeded_files)))
)

# Delete folders with it's content
# Delete folders with its content
succeeded = set()
for dirpath in dirpaths:
# Check if directory still exists
Expand All @@ -87,17 +87,21 @@ def _remove_full_paths(self, full_paths):

if succeeded:
self.log.info(
"Removed directories:\n{}".format("\n".join(succeeded))
"Removed directories:\n{}".format(
"\n".join(sorted(succeeded))
)
)

# Prepare lines for report of failed removements
# Prepare lines for report of failed removals
lines = []
for filepath, exc in failed:
lines.append("{}: {}".format(filepath, str(exc)))

if lines:
self.log.warning(
"Failed to remove filepaths:\n{}".format("\n".join(lines))
"Failed to remove filepaths:\n{}".format(
"\n".join(sorted(lines))
)
)

def _remove_empty_dirs(self, empty_dirpaths):
Expand Down Expand Up @@ -134,8 +138,8 @@ def _remove_empty_dirs(self, empty_dirpaths):

if to_skip_dirpaths:
self.log.debug(
"Skipped directories because contain files:\n{}".format(
"\n".join(to_skip_dirpaths)
"Skipped directories because they contain files:\n{}".format(
"\n".join(sorted(to_skip_dirpaths))
)
)

Expand All @@ -147,6 +151,6 @@ def _remove_empty_dirs(self, empty_dirpaths):
if to_delete_dirpaths:
self.log.debug(
"Deleted empty directories:\n{}".format(
"\n".join(to_delete_dirpaths)
"\n".join(sorted(to_delete_dirpaths))
)
)
5 changes: 3 additions & 2 deletions openpype/plugins/publish/collect_rendered_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ def _fill_staging_dir(self, data_object, anatomy):
staging_dir = data_object.get("stagingDir")
if staging_dir:
data_object["stagingDir"] = anatomy.fill_root(staging_dir)
self.log.debug("Filling stagingDir with root to: %s",
data_object["stagingDir"])

def _process_path(self, data, anatomy):
"""Process data of a single JSON publish metadata file.
Expand Down Expand Up @@ -108,7 +110,6 @@ def _process_path(self, data, anatomy):
instance = self._context.create_instance(
instance_data.get("subset")
)
self.log.debug("Filling stagingDir...")

self._fill_staging_dir(instance_data, anatomy)
instance.data.update(instance_data)
Expand Down Expand Up @@ -161,7 +162,7 @@ def process(self, context):
anatomy.project_name
))

self.log.debug("anatomy: {}".format(anatomy.roots))
self.log.debug("Anatomy roots: {}".format(anatomy.roots))
try:
session_is_set = False
for path in paths:
Expand Down
4 changes: 1 addition & 3 deletions openpype/plugins/publish/extract_burnin.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,6 @@ def main_process(self, instance):
).format(host_name, family, task_name, task_type, subset))
return

self.log.debug("profile: {}".format(profile))

# Pre-filter burnin definitions by instance families
burnin_defs = self.filter_burnins_defs(profile, instance)
if not burnin_defs:
Expand Down Expand Up @@ -450,7 +448,7 @@ def prepare_basic_data(self, instance):
filling burnin strings. `temp_data` are for repre pre-process
preparation.
"""
self.log.debug("Prepring basic data for burnins")
self.log.debug("Preparing basic data for burnins")
context = instance.context

version = instance.data.get("version")
Expand Down
1 change: 0 additions & 1 deletion openpype/plugins/publish/extract_color_transcode.py
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,6 @@ def _get_profile(self, instance):
" | Task type \"{}\" | Subset \"{}\" "
).format(host_name, family, task_name, task_type, subset))

self.log.debug("profile: {}".format(profile))
return profile

def _repre_is_valid(self, repre):
Expand Down
2 changes: 1 addition & 1 deletion openpype/plugins/publish/extract_review.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ def _get_outputs_per_representations(self, instance, profile_outputs):
custom_tags = repre.get("custom_tags")
if "review" not in tags:
self.log.debug((
"Repre: {} - Didn't found \"review\" in tags. Skipping"
"Repre: {} - Didn't find \"review\" in tags. Skipping"
).format(repre_name))
continue

Expand Down
2 changes: 1 addition & 1 deletion openpype/plugins/publish/integrate_thumbnail.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ def _get_thumbnail_path_from_published(self, published_representations):

if thumb_repre_doc is None:
self.log.debug(
"There is not representation with name \"thumbnail\""
"There is no representation with name \"thumbnail\""
)
return None

Expand Down
2 changes: 1 addition & 1 deletion openpype/plugins/publish/integrate_thumbnail_ayon.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ def _get_instance_thumbnail_path(self, published_representations):

if thumb_repre_doc is None:
self.log.debug(
"There is not representation with name \"thumbnail\""
"There is no representation with name \"thumbnail\""
)
return None

Expand Down
2 changes: 1 addition & 1 deletion openpype/settings/entities/dict_conditional.py
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ def get_child_path(self, child_obj):
break

if result_key is None:
raise ValueError("Didn't found child {}".format(child_obj))
raise ValueError("Didn't find child {}".format(child_obj))

return "/".join([self.path, result_key])

Expand Down
2 changes: 1 addition & 1 deletion openpype/settings/entities/dict_immutable_keys_entity.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ def get_child_path(self, child_obj):
break

if result_key is None:
raise ValueError("Didn't found child {}".format(child_obj))
raise ValueError("Didn't find child {}".format(child_obj))

return "/".join([self.path, result_key])

Expand Down
2 changes: 1 addition & 1 deletion openpype/settings/entities/dict_mutable_keys_entity.py
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ def get_child_path(self, child_obj):
break

if result_key is None:
raise ValueError("Didn't found child {}".format(child_obj))
raise ValueError("Didn't find child {}".format(child_obj))

return "/".join([self.path, result_key])

Expand Down
2 changes: 1 addition & 1 deletion openpype/settings/entities/item_entities.py
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ def get_child_path(self, child_obj):
break

if result_idx is None:
raise ValueError("Didn't found child {}".format(child_obj))
raise ValueError("Didn't find child {}".format(child_obj))

return "/".join([self.path, str(result_idx)])

Expand Down
2 changes: 1 addition & 1 deletion openpype/settings/entities/list_entity.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ def get_child_path(self, child_obj):
break

if result_idx is None:
raise ValueError("Didn't found child {}".format(child_obj))
raise ValueError("Didn't find child {}".format(child_obj))

return "/".join([self.path, str(result_idx)])

Expand Down
2 changes: 1 addition & 1 deletion openpype/settings/entities/root_entities.py
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ def get_child_path(self, child_entity):
for key, _child_entity in self.non_gui_children.items():
if _child_entity is child_entity:
return key
raise ValueError("Didn't found child {}".format(child_entity))
raise ValueError("Didn't find child {}".format(child_entity))

@property
def value(self):
Expand Down
Loading