Skip to content

Commit

Permalink
[nodes] replace CommandLineNode with AVCommandLineNode for alicevisio…
Browse files Browse the repository at this point in the history
…n nodes
  • Loading branch information
servantftechnicolor committed Dec 6, 2022
1 parent d0cebbe commit ae0ca71
Show file tree
Hide file tree
Showing 53 changed files with 70 additions and 63 deletions.
29 changes: 18 additions & 11 deletions meshroom/core/desc.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion meshroom/nodes/aliceVision/CameraCalibration.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from meshroom.core import desc


class CameraCalibration(desc.CommandLineNode):
class CameraCalibration(desc.AVCommandLineNode):
commandLine = 'aliceVision_cameraCalibration {allParams}'

category = 'Utils'
Expand Down
2 changes: 1 addition & 1 deletion meshroom/nodes/aliceVision/CameraInit.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down
2 changes: 1 addition & 1 deletion meshroom/nodes/aliceVision/CameraLocalization.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from meshroom.core import desc


class CameraLocalization(desc.CommandLineNode):
class CameraLocalization(desc.AVCommandLineNode):
commandLine = 'aliceVision_cameraLocalization {allParams}'

category = 'Utils'
Expand Down
2 changes: 1 addition & 1 deletion meshroom/nodes/aliceVision/CameraRigCalibration.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from meshroom.core import desc


class CameraRigCalibration(desc.CommandLineNode):
class CameraRigCalibration(desc.AVCommandLineNode):
commandLine = 'aliceVision_rigCalibration {allParams}'

category = 'Utils'
Expand Down
2 changes: 1 addition & 1 deletion meshroom/nodes/aliceVision/CameraRigLocalization.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from meshroom.core import desc


class CameraRigLocalization(desc.CommandLineNode):
class CameraRigLocalization(desc.AVCommandLineNode):
commandLine = 'aliceVision_rigLocalization {allParams}'

category = 'Utils'
Expand Down
2 changes: 1 addition & 1 deletion meshroom/nodes/aliceVision/ColorCheckerCorrection.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion meshroom/nodes/aliceVision/ColorCheckerDetection.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion meshroom/nodes/aliceVision/ConvertMesh.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from meshroom.core import desc


class ConvertMesh(desc.CommandLineNode):
class ConvertMesh(desc.AVCommandLineNode):
commandLine = 'aliceVision_convertMesh {allParams}'

category = 'Utils'
Expand Down
2 changes: 1 addition & 1 deletion meshroom/nodes/aliceVision/ConvertSfMFormat.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')

Expand Down
2 changes: 1 addition & 1 deletion meshroom/nodes/aliceVision/DepthMap.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down
2 changes: 1 addition & 1 deletion meshroom/nodes/aliceVision/DepthMapFilter.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down
2 changes: 1 addition & 1 deletion meshroom/nodes/aliceVision/DistortionCalibration.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')

Expand Down
2 changes: 1 addition & 1 deletion meshroom/nodes/aliceVision/ExportAnimatedCamera.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from meshroom.core import desc


class ExportAnimatedCamera(desc.CommandLineNode):
class ExportAnimatedCamera(desc.AVCommandLineNode):
commandLine = 'aliceVision_exportAnimatedCamera {allParams}'

category = 'Export'
Expand Down
2 changes: 1 addition & 1 deletion meshroom/nodes/aliceVision/ExportColoredPointCloud.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from meshroom.core import desc


class ExportColoredPointCloud(desc.CommandLineNode):
class ExportColoredPointCloud(desc.AVCommandLineNode):
commandLine = 'aliceVision_exportColoredPointCloud {allParams}'

category = 'Export'
Expand Down
2 changes: 1 addition & 1 deletion meshroom/nodes/aliceVision/ExportMatches.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')

Expand Down
2 changes: 1 addition & 1 deletion meshroom/nodes/aliceVision/ExportMaya.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from meshroom.core import desc


class ExportMaya(desc.CommandLineNode):
class ExportMaya(desc.AVCommandLineNode):
commandLine = 'aliceVision_exportMeshroomMaya {allParams}'

category = 'Export'
Expand Down
2 changes: 1 addition & 1 deletion meshroom/nodes/aliceVision/FeatureExtraction.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion meshroom/nodes/aliceVision/FeatureMatching.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion meshroom/nodes/aliceVision/FeatureRepeatability.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion meshroom/nodes/aliceVision/GlobalSfM.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')

Expand Down
2 changes: 1 addition & 1 deletion meshroom/nodes/aliceVision/ImageMasking.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion meshroom/nodes/aliceVision/ImageMatching.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')

Expand Down
2 changes: 1 addition & 1 deletion meshroom/nodes/aliceVision/ImageMatchingMultiSfM.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'])
Expand Down
2 changes: 1 addition & 1 deletion meshroom/nodes/aliceVision/ImageProcessing.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion meshroom/nodes/aliceVision/ImportKnownPoses.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')

Expand Down
2 changes: 1 addition & 1 deletion meshroom/nodes/aliceVision/KeyframeSelection.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from meshroom.core import desc


class KeyframeSelection(desc.CommandLineNode):
class KeyframeSelection(desc.AVCommandLineNode):
commandLine = 'aliceVision_utils_keyframeSelection {allParams}'

category = 'Utils'
Expand Down
2 changes: 1 addition & 1 deletion meshroom/nodes/aliceVision/LdrToHdrCalibration.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion meshroom/nodes/aliceVision/LdrToHdrMerge.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion meshroom/nodes/aliceVision/LdrToHdrSampling.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion meshroom/nodes/aliceVision/LightingEstimation.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from meshroom.core import desc


class LightingEstimation(desc.CommandLineNode):
class LightingEstimation(desc.AVCommandLineNode):
commandLine = 'aliceVision_utils_lightingEstimation {allParams}'

category = 'Utils'
Expand Down
2 changes: 1 addition & 1 deletion meshroom/nodes/aliceVision/MergeMeshes.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from meshroom.core import desc


class MergeMeshes(desc.CommandLineNode):
class MergeMeshes(desc.AVCommandLineNode):
commandLine = 'aliceVision_utils_mergeMeshes {allParams}'

category = 'Utils'
Expand Down
2 changes: 1 addition & 1 deletion meshroom/nodes/aliceVision/MeshDecimate.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion meshroom/nodes/aliceVision/MeshDenoising.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
2 changes: 1 addition & 1 deletion meshroom/nodes/aliceVision/MeshFiltering.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from meshroom.core import desc


class MeshFiltering(desc.CommandLineNode):
class MeshFiltering(desc.AVCommandLineNode):
commandLine = 'aliceVision_meshFiltering {allParams}'

category = 'Dense Reconstruction'
Expand Down
2 changes: 1 addition & 1 deletion meshroom/nodes/aliceVision/MeshMasking.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = '''
Expand Down
2 changes: 1 addition & 1 deletion meshroom/nodes/aliceVision/MeshResampling.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion meshroom/nodes/aliceVision/Meshing.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion meshroom/nodes/aliceVision/PanoramaCompositing.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion meshroom/nodes/aliceVision/PanoramaEstimation.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')

Expand Down
Loading

0 comments on commit ae0ca71

Please sign in to comment.