Skip to content

Commit 46f991f

Browse files
committed
[submitters] fix errors when no default submitter + skip error warnings when submitters plugins are not found
1 parent e9300a9 commit 46f991f

File tree

4 files changed

+25
-15
lines changed

4 files changed

+25
-15
lines changed

meshroom/core/__init__.py

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -120,16 +120,19 @@ def loadClasses(folder: str, packageName: str, classType: type) -> list[type]:
120120
else:
121121
classes.append(p)
122122
except Exception as e:
123-
tb = traceback.extract_tb(e.__traceback__)
124-
last_call = tb[-1]
125-
errors.append(f' * {pluginName} ({type(e).__name__}): {e}\n'
126-
# filename:lineNumber functionName
127-
f'{last_call.filename}:{last_call.lineno} {last_call.name}\n'
128-
# line of code with the error
129-
f'{last_call.line}'
130-
# Full traceback
131-
f'\n{traceback.format_exc()}\n\n'
132-
)
123+
if classType == BaseSubmitter:
124+
logging.warning(f" Could not load submitter {pluginName} from package '{package.__name__}'")
125+
else:
126+
tb = traceback.extract_tb(e.__traceback__)
127+
last_call = tb[-1]
128+
errors.append(f' * {pluginName} ({type(e).__name__}): {e}\n'
129+
# filename:lineNumber functionName
130+
f'{last_call.filename}:{last_call.lineno} {last_call.name}\n'
131+
# line of code with the error
132+
f'{last_call.line}'
133+
# Full traceback
134+
f'\n{traceback.format_exc()}\n\n'
135+
)
133136

134137
if errors:
135138
logging.warning(' The following "{package}" plugins could not be loaded:\n'

meshroom/submitters/tractorSubmitter.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -443,6 +443,10 @@ def __init__(self, parent=None):
443443
self.environment['REZ_DEV_PACKAGES_ROOT'] = os.environ['REZ_DEV_PACKAGES_ROOT']
444444
if 'REZ_PROD_PACKAGES_PATH' in os.environ:
445445
self.environment['REZ_PROD_PACKAGES_PATH'] = os.environ['REZ_PROD_PACKAGES_PATH']
446+
if 'PROD' in os.environ:
447+
self.environment['PROD'] = os.environ['PROD']
448+
if 'PROD_ROOT' in os.environ:
449+
self.environment['PROD_ROOT'] = os.environ['PROD_ROOT']
446450

447451
def createTask(self, meshroomFile, node):
448452
tags = self.DEFAULT_TAGS.copy() # copy to not modify default tags
@@ -488,7 +492,7 @@ def submit(self, nodes, edges, filepath, submitLabel="{projectName}"):
488492
tags=mainTags,
489493
requirements={'service': str(','.join(allRequirements))},
490494
environment=self.environment,
491-
user=os.environ.get('USER', os.environ.get('FARM_USER', getpass.getuser())),
495+
user=os.environ.get('FARM_USER', os.environ.get('USER', getpass.getuser())),
492496
)
493497

494498
nodeUidToTask = {}

meshroom/ui/app.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -722,11 +722,15 @@ def _submittersList(self):
722722
isDefault : True if this is the current submitter
723723
"""
724724
submittersList = []
725-
for s in meshroom.core.submitters:
725+
for i, s in enumerate(meshroom.core.submitters):
726726
submitterName = s.name if isinstance(s, BaseSubmitter) else s
727+
# If no explicit default submitter, this will be the first one
728+
isDefault = (i == 0)
729+
if self._defaultSubmitterName:
730+
isDefault = (submitterName == self._defaultSubmitterName)
727731
submittersList.append({
728732
"name": submitterName,
729-
"isDefault": True if submitterName == self._defaultSubmitterName else False
733+
"isDefault": isDefault
730734
})
731735
return submittersList
732736

meshroom/ui/qml/Application.qml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -979,15 +979,14 @@ Page {
979979
MenuSeparator {}
980980
Menu {
981981
id: submitterSelectionMenu
982-
title: "Submitter selection"
982+
title: "Submitter Selection"
983983
enabled: submitterItems.model !== undefined && submitterItems.model.length > 0
984984
Repeater {
985985
id: submitterItems
986986
model: MeshroomApp.submittersListModel
987987
RadioButton {
988988
text: modelData["name"]
989989
checked: modelData["isDefault"]
990-
// checked: MeshroomApp.submittersListModel[0]["name"] == modelData["name"]
991990
onClicked: MeshroomApp.setDefaultSubmitter(modelData["name"])
992991
}
993992
}

0 commit comments

Comments
 (0)