Skip to content
Closed
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
4 changes: 2 additions & 2 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
flake8 . --count --select=E9,F63,F7,F82,F401 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with pytest
Expand Down Expand Up @@ -77,7 +77,7 @@ jobs:
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
flake8 . --count --select=E9,F63,F7,F82,F401 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with pytest
Expand Down
2 changes: 1 addition & 1 deletion bin/meshroom_compute
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ meshroom.setupEnvironment()

import meshroom.core
import meshroom.core.graph
from meshroom.core.node import Status, ExecMode
from meshroom.core.node import Status


parser = argparse.ArgumentParser(description='Execute a Graph of processes.')
Expand Down
12 changes: 8 additions & 4 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
if hasattr(logging, levelName) or hasattr(logging, methodName) or hasattr(logging.getLoggerClass(), methodName):
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 @@ -76,7 +79,8 @@ def setupEnvironment(backend=Backend.STANDALONE):
"""
Setup environment for Meshroom to work in a prebuilt, standalone configuration.

Use 'MESHROOM_INSTALL_DIR' to simulate standalone configuration with a path to a Meshroom installation folder.
Use 'MESHROOM_INSTALL_DIR' to simulate standalone configuration with a path to a Meshroom
installation folder.

# Meshroom standalone structure

Expand Down
17 changes: 10 additions & 7 deletions meshroom/core/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
from meshroom.core.submitter import BaseSubmitter
from meshroom.env import EnvVar, meshroomFolder
from . import desc
from .desc import MrNodeType
from .desc import MrNodeType # Not used here but simplifies imports for files that need it

# Setup logging
logging.basicConfig(format='[%(asctime)s][%(levelname)s] %(message)s', level=logging.INFO)
Expand Down Expand Up @@ -81,7 +81,8 @@ def loadClasses(folder: str, packageName: str, classType: type) -> list[type]:
except Exception as e:
tb = traceback.extract_tb(e.__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 '
f'"{resolvedFolder}" ({type(e).__name__}): {str(e)}\n'
# filename:lineNumber functionName
f'{last_call.filename}:{last_call.lineno} {last_call.name}\n'
# line of code with the error
Expand All @@ -105,7 +106,8 @@ def loadClasses(folder: str, packageName: str, classType: type) -> list[type]:
isPackage = hasattr(pluginMod, "__path__")
# Sub-folders/Packages should not raise a warning
if not isPackage:
logging.warning(f"No class defined in plugin: {package.__name__}.{pluginName} ('{pluginMod.__file__}')")
logging.warning(f"No class defined in plugin: "
f"{package.__name__}.{pluginName} ('{pluginMod.__file__}')")

for p in plugins:
p.packageName = packageName
Expand All @@ -114,8 +116,8 @@ 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 "
f"valid default values/ranges: {', '.join(nodePlugin.errors)}")
classes.append(nodePlugin)
else:
classes.append(p)
Expand Down Expand Up @@ -438,7 +440,7 @@ def initPlugins():
plugin.processEnv = processEnvFactory(f, plugin.configEnv)

# Rez plugins (with a RezProcessEnv)
rezPlugins = initRezPlugins()
initRezPlugins()


def initRezPlugins():
Expand All @@ -452,6 +454,7 @@ def initRezPlugins():
# Set the ProcessEnv for Rez plugins
if plugins:
for plugin in plugins:
plugin.processEnv = processEnvFactory(path, plugin.configEnv, envType="rez", uri=name)
plugin.processEnv = processEnvFactory(path, plugin.configEnv, envType="rez",
uri=name)

return rezPlugins
Loading
Loading