Enhancement: Some publish logs cosmetics (#5917)

* Write logs in sorted order for better logs

* Typo in log message

* More descriptive log

* Skip logging profile since `filter_profiles` already logs "Profile selected: {profile}"

* Fix grammar

* Fix grammar

* Improve logged information
This commit is contained in:
Roy Nieterau 2023-11-15 10:09:37 +01:00 committed by GitHub
parent 72b1e759e7
commit 91e230a321
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
21 changed files with 36 additions and 34 deletions

View file

@ -190,7 +190,7 @@ class LoadImage(plugin.Loader):
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
)
)

View file

@ -66,7 +66,7 @@ class TransferHierarchicalValues(ServerAction):
"items": [{
"type": "label",
"value": (
"Didn't found custom attributes"
"Didn't find custom attributes"
" that can be transferred."
)
}]

View file

@ -257,7 +257,7 @@ class NextTaskUpdate(BaseEvent):
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"]
)
)

View file

@ -387,7 +387,7 @@ class SyncToAvalonEvent(BaseEvent):
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
)
)

View file

@ -51,7 +51,7 @@ class ComponentOpen(BaseAction):
else:
return {
'success': False,
'message': "Didn't found file: " + fpath
'message': "Didn't find file: " + fpath
}
return {

View file

@ -169,7 +169,7 @@ class DeleteAssetSubset(BaseAction):
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."
)
}

View file

@ -61,7 +61,7 @@ class Delivery(BaseAction):
return {
"success": False,
"message": (
"Didn't found project \"{}\" in avalon."
"Didn't find project \"{}\" in avalon."
).format(project_name)
}

View file

@ -29,7 +29,7 @@ class JobKiller(BaseAction):
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

View file

@ -58,21 +58,21 @@ class ExplicitCleanUp(pyblish.api.ContextPlugin):
# 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
@ -87,17 +87,21 @@ class ExplicitCleanUp(pyblish.api.ContextPlugin):
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):
@ -134,8 +138,8 @@ class ExplicitCleanUp(pyblish.api.ContextPlugin):
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))
)
)
@ -147,6 +151,6 @@ class ExplicitCleanUp(pyblish.api.ContextPlugin):
if to_delete_dirpaths:
self.log.debug(
"Deleted empty directories:\n{}".format(
"\n".join(to_delete_dirpaths)
"\n".join(sorted(to_delete_dirpaths))
)
)

View file

@ -54,6 +54,8 @@ class CollectRenderedFiles(pyblish.api.ContextPlugin):
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.
@ -108,7 +110,6 @@ class CollectRenderedFiles(pyblish.api.ContextPlugin):
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)
@ -161,7 +162,7 @@ class CollectRenderedFiles(pyblish.api.ContextPlugin):
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:

View file

@ -171,8 +171,6 @@ class ExtractBurnin(publish.Extractor):
).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:
@ -450,7 +448,7 @@ class ExtractBurnin(publish.Extractor):
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")

View file

@ -326,7 +326,6 @@ class ExtractOIIOTranscode(publish.Extractor):
" | 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):

View file

@ -143,7 +143,7 @@ class ExtractReview(pyblish.api.InstancePlugin):
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

View file

@ -200,7 +200,7 @@ class IntegrateThumbnails(pyblish.api.ContextPlugin):
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

View file

@ -137,7 +137,7 @@ class IntegrateThumbnailsAYON(pyblish.api.ContextPlugin):
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

View file

@ -352,7 +352,7 @@ class DictConditionalEntity(ItemEntity):
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])

View file

@ -232,7 +232,7 @@ class DictImmutableKeysEntity(ItemEntity):
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])

View file

@ -284,7 +284,7 @@ class DictMutableKeysEntity(EndpointEntity):
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])

View file

@ -295,7 +295,7 @@ class ListStrictEntity(ItemEntity):
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)])

View file

@ -258,7 +258,7 @@ class ListEntity(EndpointEntity):
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)])

View file

@ -270,7 +270,7 @@ class RootEntity(BaseItemEntity):
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):