Skip to content
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
16 changes: 16 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
# [tests] Linting: Remove trailing whitespaces
5fe886b6b08fa19082dc0e1bf837fa34c2e2de2d
# [core] Linting: Remove remaining trailing whitespaces
a44537b65a7c53c89c16e71ae207f37fa6554832
# Linting: Fix E203, E225, E231, E261, E302, E303 and W292 warnings
1b5664c8cc54c55fae58a5be9bf63e9af2f5af95
# [ui] Linting: Remove all trailing whitespaces
18d7f609b1a5cd7c43f970770374b649019c1e73
# [core] Linting: Fix import order
aae05532b2409e3bd4c119646afc08656a916cb4
# [core] Linting: Remove all trailing whitespaces
81394d7def1fcbc08cbc2a8721bc1f0a86fe8cc6
# [desc] Linting: Remove trailing whitespaces
0a2ab8cab4f79191b0e7364416701ba561e75b6a
# [desc] Linting: Fix order of the imported modules
adf67e33533a75f5b280e0ee3fc0ece82307199e
# [build] `setup.py`: Use double quotes everywhere
571de38ef1a9e72e6c1d2a997b60de5bd3caa5bf
# [bin] `meshroom_batch`: Minor clean-up in the file
Expand Down
8 changes: 6 additions & 2 deletions meshroom/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import os
import sys


class VersionStatus(Enum):
release = 1
develop = 2
Expand Down Expand Up @@ -42,16 +43,18 @@ class VersionStatus(Enum):

useMultiChunks = util.strtobool(os.environ.get("MESHROOM_USE_MULTI_CHUNKS", "True"))

# Logging

# Logging
def addTraceLevel():
""" From https://stackoverflow.com/a/35804945 """
levelName, methodName, levelNum = 'TRACE', 'trace', logging.DEBUG - 5
if hasattr(logging, levelName) or hasattr(logging, methodName)or hasattr(logging.getLoggerClass(), methodName):
return
return

def logForLevel(self, message, *args, **kwargs):
if self.isEnabledFor(levelNum):
self._log(levelNum, message, args, **kwargs)

def logToRoot(message, *args, **kwargs):
logging.log(levelNum, message, *args, **kwargs)

Expand All @@ -60,6 +63,7 @@ def logToRoot(message, *args, **kwargs):
setattr(logging.getLoggerClass(), methodName, logForLevel)
setattr(logging, methodName, logToRoot)


addTraceLevel()
logStringToPython = {
'fatal': logging.CRITICAL,
Expand Down
16 changes: 8 additions & 8 deletions meshroom/core/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,10 @@ def loadClasses(folder: str, packageName: str, classType: type) -> list[type]:
else package.__name__
packageVersion = getattr(package, "__version__", None)
packagePath = os.path.dirname(package.__file__)
except Exception as e:
tb = traceback.extract_tb(e.__traceback__)
except Exception as exc:
tb = traceback.extract_tb(exc.__traceback__)
last_call = tb[-1]
logging.warning(f' * Failed to load package "{packageName}" from folder "{resolvedFolder}" ({type(e).__name__}): {str(e)}\n'
logging.warning(f' * Failed to load package "{packageName}" from folder "{resolvedFolder}" ({type(exc).__name__}): {str(exc)}\n'
# filename:lineNumber functionName
f'{last_call.filename}:{last_call.lineno} {last_call.name}\n'
# line of code with the error
Expand Down Expand Up @@ -114,18 +114,18 @@ def loadClasses(folder: str, packageName: str, classType: type) -> list[type]:
if classType == desc.BaseNode:
nodePlugin = NodePlugin(p)
if nodePlugin.errors:
errors.append(" * {}: The following parameters do not have valid " \
"default values/ranges: {}".format(pluginName, ", ".join(nodePlugin.errors)))
errors.append(f" * {pluginName}: The following parameters do not have valid "
f"default values/ranges: {', '.join(nodePlugin.errors)}")
classes.append(nodePlugin)
else:
classes.append(p)
except Exception as e:
except Exception as exc:
if classType == BaseSubmitter:
logging.warning(f" Could not load submitter {pluginName} from package '{package.__name__}'")
else:
tb = traceback.extract_tb(e.__traceback__)
tb = traceback.extract_tb(exc.__traceback__)
last_call = tb[-1]
errors.append(f' * {pluginName} ({type(e).__name__}): {e}\n'
errors.append(f' * {pluginName} ({type(exc).__name__}): {exc}\n'
# filename:lineNumber functionName
f'{last_call.filename}:{last_call.lineno} {last_call.name}\n'
# line of code with the error
Expand Down
Loading