From 788bd7738bd88af82167460d8728f5e507626a1d Mon Sep 17 00:00:00 2001 From: Fabien Servant Date: Fri, 2 Dec 2022 05:47:19 +0000 Subject: [PATCH 1/9] [core] add cgroups checks --- meshroom/core/cgroup.py | 101 ++++++++++++++++++++++++++++++++++++++++ meshroom/core/desc.py | 16 ++++++- 2 files changed, 116 insertions(+), 1 deletion(-) create mode 100755 meshroom/core/cgroup.py diff --git a/meshroom/core/cgroup.py b/meshroom/core/cgroup.py new file mode 100755 index 0000000000..ba0d2cbd13 --- /dev/null +++ b/meshroom/core/cgroup.py @@ -0,0 +1,101 @@ +#!/usr/bin/env python +# coding:utf-8 + +import os + +#Try to retrieve limits of memory for the current process' cgroup +def getCgroupMemorySize(): + + #first of all, get pid of process + pid = os.getpid() + + #Get cgroup associated with pid + filename = f"/proc/{pid}/cgroup" + + cgroup = None + try: + with open(filename, "r") as f : + + #cgroup file is a ':' separated table + #lookup a line where the second field is "memory" + lines = f.readlines() + for line in lines: + tokens = line.rstrip("\r\n").split(":") + if len(tokens) < 3: + continue + if tokens[1] == "memory": + cgroup = tokens[2] + except IOError: + pass + + if cgroup is None: + return -1 + + size = -1 + filename = f"/sys/fs/cgroup/memory/{cgroup}" + try: + with open(filename, "r") as f : + value = f.read().rstrip("\r\n") + if value.isnumeric(): + size = int(value) + except IOError: + pass + + return size + +def parseNumericList(str): + + nList = [] + for item in str.split(','): + if '-' in item: + start, end = item.split('-') + start = int(start) + end = int(end) + nList.extend(range(start, end + 1)) + else: + value = int(item) + nList.append(value) + + return nList + +#Try to retrieve limits of cores for the current process' cgroup +def getCgroupCpuCount(): + + #first of all, get pid of process + pid = os.getpid() + + #Get cgroup associated with pid + filename = f"/proc/{pid}/cgroup" + + cgroup = None + try: + with open(filename, "r") as f : + + #cgroup file is a ':' separated table + #lookup a line where the second field is "memory" + lines = f.readlines() + for line in lines: + tokens = line.rstrip("\r\n").split(":") + if len(tokens) < 3: + continue + if tokens[1] == "cpuset": + cgroup = tokens[2] + except IOError: + pass + + if cgroup is None: + return -1 + + size = -1 + filename = f"/sys/fs/cgroup/cpuset/{cgroup}/cpuset.cpus" + try: + with open(filename, "r") as f : + value = f.read().rstrip("\r\n") + nlist = parseNumericList(value) + size = len(nlist) + + except IOError: + pass + + return size + diff --git a/meshroom/core/desc.py b/meshroom/core/desc.py index a893162655..d4bf7cfd26 100644 --- a/meshroom/core/desc.py +++ b/meshroom/core/desc.py @@ -1,4 +1,5 @@ from meshroom.common import BaseObject, Property, Variant, VariantList, JSValue +from meshroom.core import pyCompatibility, cgroup from collections.abc import Iterable from enum import Enum @@ -534,6 +535,7 @@ class CommandLineNode(Node): commandLineRange = '' def buildCommandLine(self, chunk): + cmdPrefix = '' # if rez available in env, we use it if 'REZ_ENV' in os.environ and chunk.node.packageVersion: @@ -541,10 +543,22 @@ def buildCommandLine(self, chunk): alreadyInEnv = os.environ.get('REZ_{}_VERSION'.format(chunk.node.packageName.upper()), "").startswith(chunk.node.packageVersion) if not alreadyInEnv: cmdPrefix = '{rez} {packageFullName} -- '.format(rez=os.environ.get('REZ_ENV'), packageFullName=chunk.node.packageFullName) + cmdSuffix = '' if chunk.node.isParallelized and chunk.node.size > 1: cmdSuffix = ' ' + self.commandLineRange.format(**chunk.range.toDict()) - return cmdPrefix + chunk.node.nodeDesc.commandLine.format(**chunk.node._cmdVars) + cmdSuffix + + cmdMem = '' + memSize = cgroup.getCgroupMemorySize() + if memSize > 0: + cmdMem = ' --maxMemory={memSize}'.format(memSize=memSize) + + cmdCore = '' + coresCount = cgroup.getCgroupCpuCount() + if coresCount > 0: + cmdCore = ' --maxCores={coresCount}'.format(coresCount=coresCount) + + return cmdPrefix + chunk.node.nodeDesc.commandLine.format(**chunk.node._cmdVars) + cmdMem + cmdCore + cmdSuffix def stopProcess(self, chunk): # the same node could exists several times in the graph and From d0cebbe2b0dc587fc51aba48e1495873282100a1 Mon Sep 17 00:00:00 2001 From: Fabien Servant Date: Fri, 2 Dec 2022 08:40:28 +0000 Subject: [PATCH 2/9] [cgroup] forgot filename --- meshroom/core/cgroup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meshroom/core/cgroup.py b/meshroom/core/cgroup.py index ba0d2cbd13..4a38a8ebd1 100755 --- a/meshroom/core/cgroup.py +++ b/meshroom/core/cgroup.py @@ -32,7 +32,7 @@ def getCgroupMemorySize(): return -1 size = -1 - filename = f"/sys/fs/cgroup/memory/{cgroup}" + filename = f"/sys/fs/cgroup/memory/{cgroup}/memory.limit_in_bytes" try: with open(filename, "r") as f : value = f.read().rstrip("\r\n") From ae0ca71c1c9d5e06b711f272cc7f77ee96956825 Mon Sep 17 00:00:00 2001 From: fabien servant Date: Tue, 6 Dec 2022 15:02:05 +0100 Subject: [PATCH 3/9] [nodes] replace CommandLineNode with AVCommandLineNode for alicevision nodes --- meshroom/core/desc.py | 29 ++++++++++++------- .../nodes/aliceVision/CameraCalibration.py | 2 +- meshroom/nodes/aliceVision/CameraInit.py | 2 +- .../nodes/aliceVision/CameraLocalization.py | 2 +- .../nodes/aliceVision/CameraRigCalibration.py | 2 +- .../aliceVision/CameraRigLocalization.py | 2 +- .../aliceVision/ColorCheckerCorrection.py | 2 +- .../aliceVision/ColorCheckerDetection.py | 2 +- meshroom/nodes/aliceVision/ConvertMesh.py | 2 +- .../nodes/aliceVision/ConvertSfMFormat.py | 2 +- meshroom/nodes/aliceVision/DepthMap.py | 2 +- meshroom/nodes/aliceVision/DepthMapFilter.py | 2 +- .../aliceVision/DistortionCalibration.py | 2 +- .../nodes/aliceVision/ExportAnimatedCamera.py | 2 +- .../aliceVision/ExportColoredPointCloud.py | 2 +- meshroom/nodes/aliceVision/ExportMatches.py | 2 +- meshroom/nodes/aliceVision/ExportMaya.py | 2 +- .../nodes/aliceVision/FeatureExtraction.py | 2 +- meshroom/nodes/aliceVision/FeatureMatching.py | 2 +- .../nodes/aliceVision/FeatureRepeatability.py | 2 +- meshroom/nodes/aliceVision/GlobalSfM.py | 2 +- meshroom/nodes/aliceVision/ImageMasking.py | 2 +- meshroom/nodes/aliceVision/ImageMatching.py | 2 +- .../aliceVision/ImageMatchingMultiSfM.py | 2 +- meshroom/nodes/aliceVision/ImageProcessing.py | 2 +- .../nodes/aliceVision/ImportKnownPoses.py | 2 +- .../nodes/aliceVision/KeyframeSelection.py | 2 +- .../nodes/aliceVision/LdrToHdrCalibration.py | 2 +- meshroom/nodes/aliceVision/LdrToHdrMerge.py | 2 +- .../nodes/aliceVision/LdrToHdrSampling.py | 2 +- .../nodes/aliceVision/LightingEstimation.py | 2 +- meshroom/nodes/aliceVision/MergeMeshes.py | 2 +- meshroom/nodes/aliceVision/MeshDecimate.py | 2 +- meshroom/nodes/aliceVision/MeshDenoising.py | 2 +- meshroom/nodes/aliceVision/MeshFiltering.py | 2 +- meshroom/nodes/aliceVision/MeshMasking.py | 2 +- meshroom/nodes/aliceVision/MeshResampling.py | 2 +- meshroom/nodes/aliceVision/Meshing.py | 2 +- .../nodes/aliceVision/PanoramaCompositing.py | 2 +- .../nodes/aliceVision/PanoramaEstimation.py | 2 +- meshroom/nodes/aliceVision/PanoramaInit.py | 2 +- meshroom/nodes/aliceVision/PanoramaMerging.py | 2 +- .../aliceVision/PanoramaPrepareImages.py | 2 +- meshroom/nodes/aliceVision/PanoramaSeams.py | 2 +- meshroom/nodes/aliceVision/PanoramaWarping.py | 2 +- .../nodes/aliceVision/PrepareDenseScene.py | 2 +- meshroom/nodes/aliceVision/SfMAlignment.py | 2 +- meshroom/nodes/aliceVision/SfMDistances.py | 2 +- meshroom/nodes/aliceVision/SfMTransfer.py | 2 +- meshroom/nodes/aliceVision/SfMTransform.py | 2 +- meshroom/nodes/aliceVision/Split360Images.py | 2 +- .../nodes/aliceVision/StructureFromMotion.py | 2 +- meshroom/nodes/aliceVision/Texturing.py | 2 +- 53 files changed, 70 insertions(+), 63 deletions(-) diff --git a/meshroom/core/desc.py b/meshroom/core/desc.py index d4bf7cfd26..10eee4aeb3 100644 --- a/meshroom/core/desc.py +++ b/meshroom/core/desc.py @@ -548,17 +548,7 @@ def buildCommandLine(self, chunk): if chunk.node.isParallelized and chunk.node.size > 1: cmdSuffix = ' ' + self.commandLineRange.format(**chunk.range.toDict()) - cmdMem = '' - memSize = cgroup.getCgroupMemorySize() - if memSize > 0: - cmdMem = ' --maxMemory={memSize}'.format(memSize=memSize) - - cmdCore = '' - coresCount = cgroup.getCgroupCpuCount() - if coresCount > 0: - cmdCore = ' --maxCores={coresCount}'.format(coresCount=coresCount) - - return cmdPrefix + chunk.node.nodeDesc.commandLine.format(**chunk.node._cmdVars) + cmdMem + cmdCore + cmdSuffix + return cmdPrefix + chunk.node.nodeDesc.commandLine.format(**chunk.node._cmdVars) + cmdSuffix def stopProcess(self, chunk): # the same node could exists several times in the graph and @@ -603,6 +593,23 @@ def processChunk(self, chunk): finally: chunk.subprocess = None +#specific command line node for alicevision apps +class AVCommandLineNode(CommandLineNode): + def buildCommandLine(self, chunk): + + str = super(AVCommandLineNode, self).buildCommandLine(chunk) + + cmdMem = '' + memSize = cgroup.getCgroupMemorySize() + if memSize > 0: + cmdMem = ' --maxMemory={memSize}'.format(memSize=memSize) + + cmdCore = '' + coresCount = cgroup.getCgroupCpuCount() + if coresCount > 0: + cmdCore = ' --maxCores={coresCount}'.format(coresCount=coresCount) + + return str + cmdMem + cmdCore # Test abstract node class InitNode: diff --git a/meshroom/nodes/aliceVision/CameraCalibration.py b/meshroom/nodes/aliceVision/CameraCalibration.py index 888138cc3a..86a647f04c 100644 --- a/meshroom/nodes/aliceVision/CameraCalibration.py +++ b/meshroom/nodes/aliceVision/CameraCalibration.py @@ -3,7 +3,7 @@ from meshroom.core import desc -class CameraCalibration(desc.CommandLineNode): +class CameraCalibration(desc.AVCommandLineNode): commandLine = 'aliceVision_cameraCalibration {allParams}' category = 'Utils' diff --git a/meshroom/nodes/aliceVision/CameraInit.py b/meshroom/nodes/aliceVision/CameraInit.py index feb529cd29..6d959d2f71 100644 --- a/meshroom/nodes/aliceVision/CameraInit.py +++ b/meshroom/nodes/aliceVision/CameraInit.py @@ -119,7 +119,7 @@ def readSfMData(sfmFile): return views, intrinsics -class CameraInit(desc.CommandLineNode, desc.InitNode): +class CameraInit(desc.AVCommandLineNode, desc.InitNode): commandLine = 'aliceVision_cameraInit {allParams} --allowSingleView 1' # don't throw an error if there is only one image size = desc.DynamicNodeSize('viewpoints') diff --git a/meshroom/nodes/aliceVision/CameraLocalization.py b/meshroom/nodes/aliceVision/CameraLocalization.py index 1f98119d49..055b7687a9 100644 --- a/meshroom/nodes/aliceVision/CameraLocalization.py +++ b/meshroom/nodes/aliceVision/CameraLocalization.py @@ -4,7 +4,7 @@ from meshroom.core import desc -class CameraLocalization(desc.CommandLineNode): +class CameraLocalization(desc.AVCommandLineNode): commandLine = 'aliceVision_cameraLocalization {allParams}' category = 'Utils' diff --git a/meshroom/nodes/aliceVision/CameraRigCalibration.py b/meshroom/nodes/aliceVision/CameraRigCalibration.py index 3fa103e186..b575ea0db8 100644 --- a/meshroom/nodes/aliceVision/CameraRigCalibration.py +++ b/meshroom/nodes/aliceVision/CameraRigCalibration.py @@ -4,7 +4,7 @@ from meshroom.core import desc -class CameraRigCalibration(desc.CommandLineNode): +class CameraRigCalibration(desc.AVCommandLineNode): commandLine = 'aliceVision_rigCalibration {allParams}' category = 'Utils' diff --git a/meshroom/nodes/aliceVision/CameraRigLocalization.py b/meshroom/nodes/aliceVision/CameraRigLocalization.py index ca4875c224..063acbbe38 100644 --- a/meshroom/nodes/aliceVision/CameraRigLocalization.py +++ b/meshroom/nodes/aliceVision/CameraRigLocalization.py @@ -4,7 +4,7 @@ from meshroom.core import desc -class CameraRigLocalization(desc.CommandLineNode): +class CameraRigLocalization(desc.AVCommandLineNode): commandLine = 'aliceVision_rigLocalization {allParams}' category = 'Utils' diff --git a/meshroom/nodes/aliceVision/ColorCheckerCorrection.py b/meshroom/nodes/aliceVision/ColorCheckerCorrection.py index 0b5e65547c..256ceaee5c 100644 --- a/meshroom/nodes/aliceVision/ColorCheckerCorrection.py +++ b/meshroom/nodes/aliceVision/ColorCheckerCorrection.py @@ -5,7 +5,7 @@ import os.path -class ColorCheckerCorrection(desc.CommandLineNode): +class ColorCheckerCorrection(desc.AVCommandLineNode): commandLine = 'aliceVision_utils_colorCheckerCorrection {allParams}' size = desc.DynamicNodeSize('input') # parallelization = desc.Parallelization(blockSize=40) diff --git a/meshroom/nodes/aliceVision/ColorCheckerDetection.py b/meshroom/nodes/aliceVision/ColorCheckerDetection.py index f3109cfe74..eab8925a52 100644 --- a/meshroom/nodes/aliceVision/ColorCheckerDetection.py +++ b/meshroom/nodes/aliceVision/ColorCheckerDetection.py @@ -5,7 +5,7 @@ import os.path -class ColorCheckerDetection(desc.CommandLineNode): +class ColorCheckerDetection(desc.AVCommandLineNode): commandLine = 'aliceVision_utils_colorCheckerDetection {allParams}' size = desc.DynamicNodeSize('input') # parallelization = desc.Parallelization(blockSize=40) diff --git a/meshroom/nodes/aliceVision/ConvertMesh.py b/meshroom/nodes/aliceVision/ConvertMesh.py index 9ea7b57015..2bacbac365 100644 --- a/meshroom/nodes/aliceVision/ConvertMesh.py +++ b/meshroom/nodes/aliceVision/ConvertMesh.py @@ -3,7 +3,7 @@ from meshroom.core import desc -class ConvertMesh(desc.CommandLineNode): +class ConvertMesh(desc.AVCommandLineNode): commandLine = 'aliceVision_convertMesh {allParams}' category = 'Utils' diff --git a/meshroom/nodes/aliceVision/ConvertSfMFormat.py b/meshroom/nodes/aliceVision/ConvertSfMFormat.py index 1c859ea382..0fd163f6ab 100644 --- a/meshroom/nodes/aliceVision/ConvertSfMFormat.py +++ b/meshroom/nodes/aliceVision/ConvertSfMFormat.py @@ -3,7 +3,7 @@ from meshroom.core import desc -class ConvertSfMFormat(desc.CommandLineNode): +class ConvertSfMFormat(desc.AVCommandLineNode): commandLine = 'aliceVision_convertSfMFormat {allParams}' size = desc.DynamicNodeSize('input') diff --git a/meshroom/nodes/aliceVision/DepthMap.py b/meshroom/nodes/aliceVision/DepthMap.py index 6f1508540d..6014967065 100644 --- a/meshroom/nodes/aliceVision/DepthMap.py +++ b/meshroom/nodes/aliceVision/DepthMap.py @@ -3,7 +3,7 @@ from meshroom.core import desc -class DepthMap(desc.CommandLineNode): +class DepthMap(desc.AVCommandLineNode): commandLine = 'aliceVision_depthMapEstimation {allParams}' gpu = desc.Level.INTENSIVE size = desc.DynamicNodeSize('input') diff --git a/meshroom/nodes/aliceVision/DepthMapFilter.py b/meshroom/nodes/aliceVision/DepthMapFilter.py index c52dd2337f..3acebbacc5 100644 --- a/meshroom/nodes/aliceVision/DepthMapFilter.py +++ b/meshroom/nodes/aliceVision/DepthMapFilter.py @@ -3,7 +3,7 @@ from meshroom.core import desc -class DepthMapFilter(desc.CommandLineNode): +class DepthMapFilter(desc.AVCommandLineNode): commandLine = 'aliceVision_depthMapFiltering {allParams}' gpu = desc.Level.NORMAL size = desc.DynamicNodeSize('input') diff --git a/meshroom/nodes/aliceVision/DistortionCalibration.py b/meshroom/nodes/aliceVision/DistortionCalibration.py index 8f00606274..b69a2b7c9e 100644 --- a/meshroom/nodes/aliceVision/DistortionCalibration.py +++ b/meshroom/nodes/aliceVision/DistortionCalibration.py @@ -3,7 +3,7 @@ from meshroom.core import desc -class DistortionCalibration(desc.CommandLineNode): +class DistortionCalibration(desc.AVCommandLineNode): commandLine = 'aliceVision_distortionCalibration {allParams}' size = desc.DynamicNodeSize('input') diff --git a/meshroom/nodes/aliceVision/ExportAnimatedCamera.py b/meshroom/nodes/aliceVision/ExportAnimatedCamera.py index 1fc1ac95c3..de503cea39 100644 --- a/meshroom/nodes/aliceVision/ExportAnimatedCamera.py +++ b/meshroom/nodes/aliceVision/ExportAnimatedCamera.py @@ -3,7 +3,7 @@ from meshroom.core import desc -class ExportAnimatedCamera(desc.CommandLineNode): +class ExportAnimatedCamera(desc.AVCommandLineNode): commandLine = 'aliceVision_exportAnimatedCamera {allParams}' category = 'Export' diff --git a/meshroom/nodes/aliceVision/ExportColoredPointCloud.py b/meshroom/nodes/aliceVision/ExportColoredPointCloud.py index 7ab7855bff..2f18c94cea 100644 --- a/meshroom/nodes/aliceVision/ExportColoredPointCloud.py +++ b/meshroom/nodes/aliceVision/ExportColoredPointCloud.py @@ -3,7 +3,7 @@ from meshroom.core import desc -class ExportColoredPointCloud(desc.CommandLineNode): +class ExportColoredPointCloud(desc.AVCommandLineNode): commandLine = 'aliceVision_exportColoredPointCloud {allParams}' category = 'Export' diff --git a/meshroom/nodes/aliceVision/ExportMatches.py b/meshroom/nodes/aliceVision/ExportMatches.py index 2a1aeebcfe..b2cd04a39e 100644 --- a/meshroom/nodes/aliceVision/ExportMatches.py +++ b/meshroom/nodes/aliceVision/ExportMatches.py @@ -3,7 +3,7 @@ from meshroom.core import desc -class ExportMatches(desc.CommandLineNode): +class ExportMatches(desc.AVCommandLineNode): commandLine = 'aliceVision_exportMatches {allParams}' size = desc.DynamicNodeSize('input') diff --git a/meshroom/nodes/aliceVision/ExportMaya.py b/meshroom/nodes/aliceVision/ExportMaya.py index 99dacf1221..b297b81cf5 100644 --- a/meshroom/nodes/aliceVision/ExportMaya.py +++ b/meshroom/nodes/aliceVision/ExportMaya.py @@ -3,7 +3,7 @@ from meshroom.core import desc -class ExportMaya(desc.CommandLineNode): +class ExportMaya(desc.AVCommandLineNode): commandLine = 'aliceVision_exportMeshroomMaya {allParams}' category = 'Export' diff --git a/meshroom/nodes/aliceVision/FeatureExtraction.py b/meshroom/nodes/aliceVision/FeatureExtraction.py index 9c37f30333..3c20a690c0 100644 --- a/meshroom/nodes/aliceVision/FeatureExtraction.py +++ b/meshroom/nodes/aliceVision/FeatureExtraction.py @@ -3,7 +3,7 @@ from meshroom.core import desc -class FeatureExtraction(desc.CommandLineNode): +class FeatureExtraction(desc.AVCommandLineNode): commandLine = 'aliceVision_featureExtraction {allParams}' size = desc.DynamicNodeSize('input') parallelization = desc.Parallelization(blockSize=40) diff --git a/meshroom/nodes/aliceVision/FeatureMatching.py b/meshroom/nodes/aliceVision/FeatureMatching.py index 4c0fba1b18..cdc5b69eda 100644 --- a/meshroom/nodes/aliceVision/FeatureMatching.py +++ b/meshroom/nodes/aliceVision/FeatureMatching.py @@ -3,7 +3,7 @@ from meshroom.core import desc -class FeatureMatching(desc.CommandLineNode): +class FeatureMatching(desc.AVCommandLineNode): commandLine = 'aliceVision_featureMatching {allParams}' size = desc.DynamicNodeSize('input') parallelization = desc.Parallelization(blockSize=20) diff --git a/meshroom/nodes/aliceVision/FeatureRepeatability.py b/meshroom/nodes/aliceVision/FeatureRepeatability.py index ed22cf34cf..41d9967df5 100644 --- a/meshroom/nodes/aliceVision/FeatureRepeatability.py +++ b/meshroom/nodes/aliceVision/FeatureRepeatability.py @@ -3,7 +3,7 @@ from meshroom.core import desc -class FeatureRepeatability(desc.CommandLineNode): +class FeatureRepeatability(desc.AVCommandLineNode): commandLine = 'aliceVision_samples_repeatabilityDataset {allParams}' size = desc.DynamicNodeSize('input') # parallelization = desc.Parallelization(blockSize=40) diff --git a/meshroom/nodes/aliceVision/GlobalSfM.py b/meshroom/nodes/aliceVision/GlobalSfM.py index 8d6ebe0b17..b3e93aa02a 100644 --- a/meshroom/nodes/aliceVision/GlobalSfM.py +++ b/meshroom/nodes/aliceVision/GlobalSfM.py @@ -6,7 +6,7 @@ from meshroom.core import desc -class GlobalSfM(desc.CommandLineNode): +class GlobalSfM(desc.AVCommandLineNode): commandLine = 'aliceVision_globalSfM {allParams}' size = desc.DynamicNodeSize('input') diff --git a/meshroom/nodes/aliceVision/ImageMasking.py b/meshroom/nodes/aliceVision/ImageMasking.py index eefe335f51..e52ce5caeb 100644 --- a/meshroom/nodes/aliceVision/ImageMasking.py +++ b/meshroom/nodes/aliceVision/ImageMasking.py @@ -3,7 +3,7 @@ from meshroom.core import desc -class ImageMasking(desc.CommandLineNode): +class ImageMasking(desc.AVCommandLineNode): commandLine = 'aliceVision_imageMasking {allParams}' size = desc.DynamicNodeSize('input') parallelization = desc.Parallelization(blockSize=40) diff --git a/meshroom/nodes/aliceVision/ImageMatching.py b/meshroom/nodes/aliceVision/ImageMatching.py index f2ac0d94d5..60992785ac 100644 --- a/meshroom/nodes/aliceVision/ImageMatching.py +++ b/meshroom/nodes/aliceVision/ImageMatching.py @@ -4,7 +4,7 @@ from meshroom.core import desc -class ImageMatching(desc.CommandLineNode): +class ImageMatching(desc.AVCommandLineNode): commandLine = 'aliceVision_imageMatching {allParams}' size = desc.DynamicNodeSize('input') diff --git a/meshroom/nodes/aliceVision/ImageMatchingMultiSfM.py b/meshroom/nodes/aliceVision/ImageMatchingMultiSfM.py index c11776e768..6b25cb66af 100644 --- a/meshroom/nodes/aliceVision/ImageMatchingMultiSfM.py +++ b/meshroom/nodes/aliceVision/ImageMatchingMultiSfM.py @@ -4,7 +4,7 @@ from meshroom.core import desc -class ImageMatchingMultiSfM(desc.CommandLineNode): +class ImageMatchingMultiSfM(desc.AVCommandLineNode): commandLine = 'aliceVision_imageMatching {allParams}' # use both SfM inputs to define Node's size size = desc.MultiDynamicNodeSize(['input', 'inputB']) diff --git a/meshroom/nodes/aliceVision/ImageProcessing.py b/meshroom/nodes/aliceVision/ImageProcessing.py index 5ba2385587..54a9fdfb0d 100644 --- a/meshroom/nodes/aliceVision/ImageProcessing.py +++ b/meshroom/nodes/aliceVision/ImageProcessing.py @@ -28,7 +28,7 @@ def outputImagesValueFunct(attr): return desc.Node.internalFolder + '*' + (outputExt or '.*') -class ImageProcessing(desc.CommandLineNode): +class ImageProcessing(desc.AVCommandLineNode): commandLine = 'aliceVision_utils_imageProcessing {allParams}' size = desc.DynamicNodeSize('input') # parallelization = desc.Parallelization(blockSize=40) diff --git a/meshroom/nodes/aliceVision/ImportKnownPoses.py b/meshroom/nodes/aliceVision/ImportKnownPoses.py index d0cd8656ce..2568953599 100644 --- a/meshroom/nodes/aliceVision/ImportKnownPoses.py +++ b/meshroom/nodes/aliceVision/ImportKnownPoses.py @@ -3,7 +3,7 @@ from meshroom.core import desc -class ImportKnownPoses(desc.CommandLineNode): +class ImportKnownPoses(desc.AVCommandLineNode): commandLine = 'aliceVision_importKnownPoses {allParams}' size = desc.DynamicNodeSize('sfmData') diff --git a/meshroom/nodes/aliceVision/KeyframeSelection.py b/meshroom/nodes/aliceVision/KeyframeSelection.py index 63ecb1f6ec..668aa6333b 100644 --- a/meshroom/nodes/aliceVision/KeyframeSelection.py +++ b/meshroom/nodes/aliceVision/KeyframeSelection.py @@ -4,7 +4,7 @@ from meshroom.core import desc -class KeyframeSelection(desc.CommandLineNode): +class KeyframeSelection(desc.AVCommandLineNode): commandLine = 'aliceVision_utils_keyframeSelection {allParams}' category = 'Utils' diff --git a/meshroom/nodes/aliceVision/LdrToHdrCalibration.py b/meshroom/nodes/aliceVision/LdrToHdrCalibration.py index a1a384a3a3..968ef98d81 100644 --- a/meshroom/nodes/aliceVision/LdrToHdrCalibration.py +++ b/meshroom/nodes/aliceVision/LdrToHdrCalibration.py @@ -23,7 +23,7 @@ def findMetadata(d, keys, defaultValue): -class LdrToHdrCalibration(desc.CommandLineNode): +class LdrToHdrCalibration(desc.AVCommandLineNode): commandLine = 'aliceVision_LdrToHdrCalibration {allParams}' size = desc.DynamicNodeSize('input') cpu = desc.Level.INTENSIVE diff --git a/meshroom/nodes/aliceVision/LdrToHdrMerge.py b/meshroom/nodes/aliceVision/LdrToHdrMerge.py index cc1ee60fb2..9259a3f185 100644 --- a/meshroom/nodes/aliceVision/LdrToHdrMerge.py +++ b/meshroom/nodes/aliceVision/LdrToHdrMerge.py @@ -22,7 +22,7 @@ def findMetadata(d, keys, defaultValue): return defaultValue -class LdrToHdrMerge(desc.CommandLineNode): +class LdrToHdrMerge(desc.AVCommandLineNode): commandLine = 'aliceVision_LdrToHdrMerge {allParams}' size = desc.DynamicNodeSize('input') parallelization = desc.Parallelization(blockSize=2) diff --git a/meshroom/nodes/aliceVision/LdrToHdrSampling.py b/meshroom/nodes/aliceVision/LdrToHdrSampling.py index 3324733bfa..1d0f42b3c6 100644 --- a/meshroom/nodes/aliceVision/LdrToHdrSampling.py +++ b/meshroom/nodes/aliceVision/LdrToHdrSampling.py @@ -39,7 +39,7 @@ def computeSize(self, node): return s / divParam.value -class LdrToHdrSampling(desc.CommandLineNode): +class LdrToHdrSampling(desc.AVCommandLineNode): commandLine = 'aliceVision_LdrToHdrSampling {allParams}' size = DividedInputNodeSize('input', 'nbBrackets') parallelization = desc.Parallelization(blockSize=2) diff --git a/meshroom/nodes/aliceVision/LightingEstimation.py b/meshroom/nodes/aliceVision/LightingEstimation.py index 077b3538ad..9149dd0f46 100644 --- a/meshroom/nodes/aliceVision/LightingEstimation.py +++ b/meshroom/nodes/aliceVision/LightingEstimation.py @@ -3,7 +3,7 @@ from meshroom.core import desc -class LightingEstimation(desc.CommandLineNode): +class LightingEstimation(desc.AVCommandLineNode): commandLine = 'aliceVision_utils_lightingEstimation {allParams}' category = 'Utils' diff --git a/meshroom/nodes/aliceVision/MergeMeshes.py b/meshroom/nodes/aliceVision/MergeMeshes.py index 739e5b0447..98af5bf89d 100644 --- a/meshroom/nodes/aliceVision/MergeMeshes.py +++ b/meshroom/nodes/aliceVision/MergeMeshes.py @@ -3,7 +3,7 @@ from meshroom.core import desc -class MergeMeshes(desc.CommandLineNode): +class MergeMeshes(desc.AVCommandLineNode): commandLine = 'aliceVision_utils_mergeMeshes {allParams}' category = 'Utils' diff --git a/meshroom/nodes/aliceVision/MeshDecimate.py b/meshroom/nodes/aliceVision/MeshDecimate.py index 29b51e42de..2c42e401dc 100644 --- a/meshroom/nodes/aliceVision/MeshDecimate.py +++ b/meshroom/nodes/aliceVision/MeshDecimate.py @@ -3,7 +3,7 @@ from meshroom.core import desc -class MeshDecimate(desc.CommandLineNode): +class MeshDecimate(desc.AVCommandLineNode): commandLine = 'aliceVision_meshDecimate {allParams}' cpu = desc.Level.NORMAL ram = desc.Level.NORMAL diff --git a/meshroom/nodes/aliceVision/MeshDenoising.py b/meshroom/nodes/aliceVision/MeshDenoising.py index aa118bbe06..3fbf3592a6 100644 --- a/meshroom/nodes/aliceVision/MeshDenoising.py +++ b/meshroom/nodes/aliceVision/MeshDenoising.py @@ -3,7 +3,7 @@ from meshroom.core import desc -class MeshDenoising(desc.CommandLineNode): +class MeshDenoising(desc.AVCommandLineNode): commandLine = 'aliceVision_meshDenoising {allParams}' category = 'Mesh Post-Processing' diff --git a/meshroom/nodes/aliceVision/MeshFiltering.py b/meshroom/nodes/aliceVision/MeshFiltering.py index 6c65bda0bb..c17e666eeb 100644 --- a/meshroom/nodes/aliceVision/MeshFiltering.py +++ b/meshroom/nodes/aliceVision/MeshFiltering.py @@ -3,7 +3,7 @@ from meshroom.core import desc -class MeshFiltering(desc.CommandLineNode): +class MeshFiltering(desc.AVCommandLineNode): commandLine = 'aliceVision_meshFiltering {allParams}' category = 'Dense Reconstruction' diff --git a/meshroom/nodes/aliceVision/MeshMasking.py b/meshroom/nodes/aliceVision/MeshMasking.py index 1888f56314..5cbe4b864e 100644 --- a/meshroom/nodes/aliceVision/MeshMasking.py +++ b/meshroom/nodes/aliceVision/MeshMasking.py @@ -3,7 +3,7 @@ from meshroom.core import desc -class MeshMasking(desc.CommandLineNode): +class MeshMasking(desc.AVCommandLineNode): commandLine = 'aliceVision_meshMasking {allParams}' category = 'Mesh Post-Processing' documentation = ''' diff --git a/meshroom/nodes/aliceVision/MeshResampling.py b/meshroom/nodes/aliceVision/MeshResampling.py index 047d572b94..b9bbeed491 100644 --- a/meshroom/nodes/aliceVision/MeshResampling.py +++ b/meshroom/nodes/aliceVision/MeshResampling.py @@ -3,7 +3,7 @@ from meshroom.core import desc -class MeshResampling(desc.CommandLineNode): +class MeshResampling(desc.AVCommandLineNode): commandLine = 'aliceVision_meshResampling {allParams}' cpu = desc.Level.NORMAL ram = desc.Level.NORMAL diff --git a/meshroom/nodes/aliceVision/Meshing.py b/meshroom/nodes/aliceVision/Meshing.py index a64962c81d..364b25145f 100644 --- a/meshroom/nodes/aliceVision/Meshing.py +++ b/meshroom/nodes/aliceVision/Meshing.py @@ -3,7 +3,7 @@ from meshroom.core import desc -class Meshing(desc.CommandLineNode): +class Meshing(desc.AVCommandLineNode): commandLine = 'aliceVision_meshing {allParams}' cpu = desc.Level.INTENSIVE diff --git a/meshroom/nodes/aliceVision/PanoramaCompositing.py b/meshroom/nodes/aliceVision/PanoramaCompositing.py index 756d76db23..e7020ef9d2 100644 --- a/meshroom/nodes/aliceVision/PanoramaCompositing.py +++ b/meshroom/nodes/aliceVision/PanoramaCompositing.py @@ -6,7 +6,7 @@ from meshroom.core import desc -class PanoramaCompositing(desc.CommandLineNode): +class PanoramaCompositing(desc.AVCommandLineNode): commandLine = 'aliceVision_panoramaCompositing {allParams}' size = desc.DynamicNodeSize('input') parallelization = desc.Parallelization(blockSize=5) diff --git a/meshroom/nodes/aliceVision/PanoramaEstimation.py b/meshroom/nodes/aliceVision/PanoramaEstimation.py index 476d29b131..2882d37a18 100644 --- a/meshroom/nodes/aliceVision/PanoramaEstimation.py +++ b/meshroom/nodes/aliceVision/PanoramaEstimation.py @@ -6,7 +6,7 @@ from meshroom.core import desc -class PanoramaEstimation(desc.CommandLineNode): +class PanoramaEstimation(desc.AVCommandLineNode): commandLine = 'aliceVision_panoramaEstimation {allParams}' size = desc.DynamicNodeSize('input') diff --git a/meshroom/nodes/aliceVision/PanoramaInit.py b/meshroom/nodes/aliceVision/PanoramaInit.py index edac5cd6cc..e383bb6867 100644 --- a/meshroom/nodes/aliceVision/PanoramaInit.py +++ b/meshroom/nodes/aliceVision/PanoramaInit.py @@ -3,7 +3,7 @@ from meshroom.core import desc -class PanoramaInit(desc.CommandLineNode): +class PanoramaInit(desc.AVCommandLineNode): commandLine = 'aliceVision_panoramaInit {allParams}' size = desc.DynamicNodeSize('input') diff --git a/meshroom/nodes/aliceVision/PanoramaMerging.py b/meshroom/nodes/aliceVision/PanoramaMerging.py index f0fc6fca04..544adcbc54 100644 --- a/meshroom/nodes/aliceVision/PanoramaMerging.py +++ b/meshroom/nodes/aliceVision/PanoramaMerging.py @@ -6,7 +6,7 @@ from meshroom.core import desc -class PanoramaMerging(desc.CommandLineNode): +class PanoramaMerging(desc.AVCommandLineNode): commandLine = 'aliceVision_panoramaMerging {allParams}' size = desc.DynamicNodeSize('input') cpu = desc.Level.NORMAL diff --git a/meshroom/nodes/aliceVision/PanoramaPrepareImages.py b/meshroom/nodes/aliceVision/PanoramaPrepareImages.py index 89099f1968..e738e9c0c8 100644 --- a/meshroom/nodes/aliceVision/PanoramaPrepareImages.py +++ b/meshroom/nodes/aliceVision/PanoramaPrepareImages.py @@ -5,7 +5,7 @@ import os.path -class PanoramaPrepareImages(desc.CommandLineNode): +class PanoramaPrepareImages(desc.AVCommandLineNode): commandLine = 'aliceVision_panoramaPrepareImages {allParams}' size = desc.DynamicNodeSize('input') diff --git a/meshroom/nodes/aliceVision/PanoramaSeams.py b/meshroom/nodes/aliceVision/PanoramaSeams.py index 6817d9849b..f595617a61 100644 --- a/meshroom/nodes/aliceVision/PanoramaSeams.py +++ b/meshroom/nodes/aliceVision/PanoramaSeams.py @@ -6,7 +6,7 @@ from meshroom.core import desc -class PanoramaSeams(desc.CommandLineNode): +class PanoramaSeams(desc.AVCommandLineNode): commandLine = 'aliceVision_panoramaSeams {allParams}' size = desc.DynamicNodeSize('input') cpu = desc.Level.INTENSIVE diff --git a/meshroom/nodes/aliceVision/PanoramaWarping.py b/meshroom/nodes/aliceVision/PanoramaWarping.py index 99a38d5c2f..6517d4950c 100644 --- a/meshroom/nodes/aliceVision/PanoramaWarping.py +++ b/meshroom/nodes/aliceVision/PanoramaWarping.py @@ -6,7 +6,7 @@ from meshroom.core import desc -class PanoramaWarping(desc.CommandLineNode): +class PanoramaWarping(desc.AVCommandLineNode): commandLine = 'aliceVision_panoramaWarping {allParams}' size = desc.DynamicNodeSize('input') parallelization = desc.Parallelization(blockSize=5) diff --git a/meshroom/nodes/aliceVision/PrepareDenseScene.py b/meshroom/nodes/aliceVision/PrepareDenseScene.py index 5d475e511b..eb511533c9 100644 --- a/meshroom/nodes/aliceVision/PrepareDenseScene.py +++ b/meshroom/nodes/aliceVision/PrepareDenseScene.py @@ -3,7 +3,7 @@ from meshroom.core import desc -class PrepareDenseScene(desc.CommandLineNode): +class PrepareDenseScene(desc.AVCommandLineNode): commandLine = 'aliceVision_prepareDenseScene {allParams}' size = desc.DynamicNodeSize('input') parallelization = desc.Parallelization(blockSize=40) diff --git a/meshroom/nodes/aliceVision/SfMAlignment.py b/meshroom/nodes/aliceVision/SfMAlignment.py index a001f7cd19..53e09c9202 100644 --- a/meshroom/nodes/aliceVision/SfMAlignment.py +++ b/meshroom/nodes/aliceVision/SfMAlignment.py @@ -5,7 +5,7 @@ import os.path -class SfMAlignment(desc.CommandLineNode): +class SfMAlignment(desc.AVCommandLineNode): commandLine = 'aliceVision_utils_sfmAlignment {allParams}' size = desc.DynamicNodeSize('input') diff --git a/meshroom/nodes/aliceVision/SfMDistances.py b/meshroom/nodes/aliceVision/SfMDistances.py index 24ab23542d..1b4b91ab2d 100644 --- a/meshroom/nodes/aliceVision/SfMDistances.py +++ b/meshroom/nodes/aliceVision/SfMDistances.py @@ -3,7 +3,7 @@ from meshroom.core import desc -class SfMDistances(desc.CommandLineNode): +class SfMDistances(desc.AVCommandLineNode): commandLine = 'aliceVision_utils_sfmDistances {allParams}' size = desc.DynamicNodeSize('input') diff --git a/meshroom/nodes/aliceVision/SfMTransfer.py b/meshroom/nodes/aliceVision/SfMTransfer.py index 22f1313a5d..6c9811c398 100644 --- a/meshroom/nodes/aliceVision/SfMTransfer.py +++ b/meshroom/nodes/aliceVision/SfMTransfer.py @@ -5,7 +5,7 @@ import os.path -class SfMTransfer(desc.CommandLineNode): +class SfMTransfer(desc.AVCommandLineNode): commandLine = 'aliceVision_utils_sfmTransfer {allParams}' size = desc.DynamicNodeSize('input') diff --git a/meshroom/nodes/aliceVision/SfMTransform.py b/meshroom/nodes/aliceVision/SfMTransform.py index 439ba3af38..525a92d741 100644 --- a/meshroom/nodes/aliceVision/SfMTransform.py +++ b/meshroom/nodes/aliceVision/SfMTransform.py @@ -5,7 +5,7 @@ import os.path -class SfMTransform(desc.CommandLineNode): +class SfMTransform(desc.AVCommandLineNode): commandLine = 'aliceVision_utils_sfmTransform {allParams}' size = desc.DynamicNodeSize('input') diff --git a/meshroom/nodes/aliceVision/Split360Images.py b/meshroom/nodes/aliceVision/Split360Images.py index 4ff56bb9a4..6519a47c68 100644 --- a/meshroom/nodes/aliceVision/Split360Images.py +++ b/meshroom/nodes/aliceVision/Split360Images.py @@ -2,7 +2,7 @@ from meshroom.core import desc -class Split360Images(desc.CommandLineNode): +class Split360Images(desc.AVCommandLineNode): commandLine = 'aliceVision_utils_split360Images {allParams}' category = 'Utils' diff --git a/meshroom/nodes/aliceVision/StructureFromMotion.py b/meshroom/nodes/aliceVision/StructureFromMotion.py index 08a4541cbe..c16de93a8d 100644 --- a/meshroom/nodes/aliceVision/StructureFromMotion.py +++ b/meshroom/nodes/aliceVision/StructureFromMotion.py @@ -3,7 +3,7 @@ from meshroom.core import desc -class StructureFromMotion(desc.CommandLineNode): +class StructureFromMotion(desc.AVCommandLineNode): commandLine = 'aliceVision_incrementalSfM {allParams}' size = desc.DynamicNodeSize('input') diff --git a/meshroom/nodes/aliceVision/Texturing.py b/meshroom/nodes/aliceVision/Texturing.py index d7eb6f7cf1..a6543bec1a 100644 --- a/meshroom/nodes/aliceVision/Texturing.py +++ b/meshroom/nodes/aliceVision/Texturing.py @@ -4,7 +4,7 @@ import logging -class Texturing(desc.CommandLineNode): +class Texturing(desc.AVCommandLineNode): commandLine = 'aliceVision_texturing {allParams}' cpu = desc.Level.INTENSIVE ram = desc.Level.INTENSIVE From 41e8643834578a58339d779282c7f217f0fe9e6c Mon Sep 17 00:00:00 2001 From: mh0g Date: Tue, 6 Dec 2022 16:21:21 +0100 Subject: [PATCH 4/9] removed pyCompatibility --- meshroom/core/desc.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/meshroom/core/desc.py b/meshroom/core/desc.py index 10eee4aeb3..fa5c8a0a00 100644 --- a/meshroom/core/desc.py +++ b/meshroom/core/desc.py @@ -1,5 +1,5 @@ from meshroom.common import BaseObject, Property, Variant, VariantList, JSValue -from meshroom.core import pyCompatibility, cgroup +from meshroom.core import cgroup from collections.abc import Iterable from enum import Enum @@ -608,7 +608,7 @@ def buildCommandLine(self, chunk): coresCount = cgroup.getCgroupCpuCount() if coresCount > 0: cmdCore = ' --maxCores={coresCount}'.format(coresCount=coresCount) - + return str + cmdMem + cmdCore # Test abstract node From 6acc3fe7fcc6dd1736f558bb5ccca6176cda5c90 Mon Sep 17 00:00:00 2001 From: fabien servant Date: Wed, 7 Dec 2022 17:53:06 +0100 Subject: [PATCH 5/9] [node] update Exception class --- meshroom/core/cgroup.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/meshroom/core/cgroup.py b/meshroom/core/cgroup.py index 4a38a8ebd1..2a48aa2568 100755 --- a/meshroom/core/cgroup.py +++ b/meshroom/core/cgroup.py @@ -25,7 +25,7 @@ def getCgroupMemorySize(): continue if tokens[1] == "memory": cgroup = tokens[2] - except IOError: + except OSError: pass if cgroup is None: @@ -38,7 +38,7 @@ def getCgroupMemorySize(): value = f.read().rstrip("\r\n") if value.isnumeric(): size = int(value) - except IOError: + except OSError: pass return size @@ -80,7 +80,7 @@ def getCgroupCpuCount(): continue if tokens[1] == "cpuset": cgroup = tokens[2] - except IOError: + except OSError: pass if cgroup is None: @@ -94,7 +94,7 @@ def getCgroupCpuCount(): nlist = parseNumericList(value) size = len(nlist) - except IOError: + except OSError: pass return size From 93b98afedcd0e2b26b63e353e1316721e4cd58f6 Mon Sep 17 00:00:00 2001 From: fabien servant Date: Wed, 7 Dec 2022 17:53:48 +0100 Subject: [PATCH 6/9] [node] move cgroup properties reading in the constructor --- meshroom/core/desc.py | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/meshroom/core/desc.py b/meshroom/core/desc.py index fa5c8a0a00..fab530d562 100644 --- a/meshroom/core/desc.py +++ b/meshroom/core/desc.py @@ -595,21 +595,24 @@ def processChunk(self, chunk): #specific command line node for alicevision apps class AVCommandLineNode(CommandLineNode): - def buildCommandLine(self, chunk): - - str = super(AVCommandLineNode, self).buildCommandLine(chunk) - cmdMem = '' + def __init__(self): + + self._cmdMem = '' memSize = cgroup.getCgroupMemorySize() if memSize > 0: - cmdMem = ' --maxMemory={memSize}'.format(memSize=memSize) + self._cmdMem = ' --maxMemory={memSize}'.format(memSize=memSize) - cmdCore = '' + self._cmdCore = '' coresCount = cgroup.getCgroupCpuCount() if coresCount > 0: - cmdCore = ' --maxCores={coresCount}'.format(coresCount=coresCount) + self._cmdCore = ' --maxCores={coresCount}'.format(coresCount=coresCount) + + def buildCommandLine(self, chunk): + + str = super(AVCommandLineNode, self).buildCommandLine(chunk) - return str + cmdMem + cmdCore + return str + self._cmdMem + self._cmdCore # Test abstract node class InitNode: From 7e4c5db9d22e23d705669624dfc093e453303c55 Mon Sep 17 00:00:00 2001 From: fabien servant Date: Wed, 7 Dec 2022 18:05:12 +0100 Subject: [PATCH 7/9] [node] move cgroup parameters to class attributes --- meshroom/core/desc.py | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/meshroom/core/desc.py b/meshroom/core/desc.py index fab530d562..2551a8ec17 100644 --- a/meshroom/core/desc.py +++ b/meshroom/core/desc.py @@ -596,23 +596,31 @@ def processChunk(self, chunk): #specific command line node for alicevision apps class AVCommandLineNode(CommandLineNode): + cgroupParsed = False + cmdMem = '' + cmdCore = '' + def __init__(self): - self._cmdMem = '' - memSize = cgroup.getCgroupMemorySize() - if memSize > 0: - self._cmdMem = ' --maxMemory={memSize}'.format(memSize=memSize) + if AVCommandLineNode.cgroupParsed is False: + + AVCommandLineNode.cmdMem = '' + memSize = cgroup.getCgroupMemorySize() + if memSize > 0: + AVCommandLineNode.cmdMem = ' --maxMemory={memSize}'.format(memSize=memSize) + + AVCommandLineNode.cmdCore = '' + coresCount = cgroup.getCgroupCpuCount() + if coresCount > 0: + AVCommandLineNode.cmdCore = ' --maxCores={coresCount}'.format(coresCount=coresCount) - self._cmdCore = '' - coresCount = cgroup.getCgroupCpuCount() - if coresCount > 0: - self._cmdCore = ' --maxCores={coresCount}'.format(coresCount=coresCount) + AVCommandLineNode.cgroupParsed = True def buildCommandLine(self, chunk): str = super(AVCommandLineNode, self).buildCommandLine(chunk) - return str + self._cmdMem + self._cmdCore + return str + AVCommandLineNode.cmdMem + AVCommandLineNode.cmdCore # Test abstract node class InitNode: From 18026c3d5973b213dc1ca43b0a8a6c356a530df8 Mon Sep 17 00:00:00 2001 From: "Fabien Servant @ TCS" <100348063+servantftechnicolor@users.noreply.github.com> Date: Thu, 8 Dec 2022 09:31:30 +0100 Subject: [PATCH 8/9] [cgroup] rename variable for python 3 compliance --- meshroom/core/cgroup.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/meshroom/core/cgroup.py b/meshroom/core/cgroup.py index 2a48aa2568..e35e45f1f1 100755 --- a/meshroom/core/cgroup.py +++ b/meshroom/core/cgroup.py @@ -43,10 +43,10 @@ def getCgroupMemorySize(): return size -def parseNumericList(str): +def parseNumericList(numericListString): nList = [] - for item in str.split(','): + for item in numericListString.split(','): if '-' in item: start, end = item.split('-') start = int(start) From 06d7d96fa28033104b33df10a8eed7b27a3d9fb1 Mon Sep 17 00:00:00 2001 From: "Fabien Servant @ TCS" <100348063+servantftechnicolor@users.noreply.github.com> Date: Thu, 8 Dec 2022 09:33:06 +0100 Subject: [PATCH 9/9] rename variable for python compliance --- meshroom/core/desc.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/meshroom/core/desc.py b/meshroom/core/desc.py index 2551a8ec17..1425b18217 100644 --- a/meshroom/core/desc.py +++ b/meshroom/core/desc.py @@ -618,9 +618,9 @@ def __init__(self): def buildCommandLine(self, chunk): - str = super(AVCommandLineNode, self).buildCommandLine(chunk) + commandLineString = super(AVCommandLineNode, self).buildCommandLine(chunk) - return str + AVCommandLineNode.cmdMem + AVCommandLineNode.cmdCore + return commandLineString + AVCommandLineNode.cmdMem + AVCommandLineNode.cmdCore # Test abstract node class InitNode: