Merge pull request #96 from alicevision/dev_submitterConfig

[submitters] simpleFarm: use a config file for serviceKeys
This commit is contained in:
Fabien Castan 2018-02-23 10:42:15 +01:00 committed by GitHub
commit d6ab36c60b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 88 additions and 9 deletions

View file

@ -0,0 +1,43 @@
import sys
from meshroom.core import desc
class MeshFiltering(desc.CommandLineNode):
internalFolder = '{cache}/{nodeType}/{uid0}/'
commandLine = 'aliceVision_meshFiltering {allParams}'
inputs = [
desc.File(
name='input',
label='Input',
description='''Input Mesh (OBJ file format).''',
value='',
uid=[0],
),
desc.IntParam(
name='iterations',
label='Nb Iterations',
description='',
value=10,
range=(0, 50, 1),
uid=[0],
),
desc.FloatParam(
name='lambda',
label='Lambda',
description='',
value=1.0,
range=(0.0, 10.0, 0.1),
uid=[0],
),
]
outputs = [
desc.File(
name='output',
label='Output',
description='''Output mesh (OBJ file format).''',
value='{cache}/{nodeType}/{uid0}/mesh.obj',
uid=[],
),
]

View file

@ -40,6 +40,22 @@ class Meshing(desc.CommandLineNode):
exclusive=True,
uid=[0],
),
desc.IntParam(
name='smoothingIteration',
label='Smoothing Iteration',
description='Number of Smoothing Iterations',
value=10,
range=(0, 50, 1),
uid=[0],
),
desc.FloatParam(
name='smoothingWeight',
label='Smoothing Weight',
description='Smoothing Weight',
value=1.0,
range=(0, 2, 1),
uid=[0],
),
desc.File(
name="depthMapFolder",
label='Depth Maps Folder',

View file

@ -0,0 +1,18 @@
{
"BASE": ["mikrosRender", "!RenderLow", "!Wkst_OS", "!\"vfxpc1*\"", "!\"vfxpc??\""],
"CPU": {
"NONE": [],
"NORMAL": [],
"INTENSIVE": ["\"RenderHigh*\"", "@.nCPUs>20"]
},
"RAM": {
"NONE": [],
"NORMAL": ["@.mem>8"],
"INTENSIVE": ["@.mem>30"]
},
"GPU": {
"NONE": [],
"NORMAL": ["!\"*loc*\"", "Wkst"],
"INTENSIVE": ["!\"*loc*\"", "Wkst"]
}
}

View file

@ -2,16 +2,21 @@
# coding:utf-8
import os
import json
import simpleFarm
from meshroom.core.desc import Level
from meshroom.core.submitter import BaseSubmitter
currentDir = os.path.dirname(os.path.realpath(__file__))
class SimpleFarmSubmitter(BaseSubmitter):
MESHROOM_PACKAGE = os.environ.get('REZ_USED_REQUEST', '')
BASE_REQUIREMENTS = ['mikrosRender', '!RenderLow', '!Wkst_OS', '!"vfxpc1*"', '!"vfxpc??"']
filepath = os.environ.get('SIMPLEFARMCONFIG', os.path.join(currentDir, 'simpleFarmConfig.json'))
config = json.load(open(filepath))
ENGINE = ''
DEFAULT_TAGS = {'prod': ''}
@ -34,13 +39,10 @@ class SimpleFarmSubmitter(BaseSubmitter):
tags['nbFrames'] = nbFrames
tags['prod'] = self.prod
allRequirements = list(self.BASE_REQUIREMENTS)
if node.nodeDesc.cpu == Level.INTENSIVE:
allRequirements.extend(['"RenderHigh*"', '@.nCPUs>20'])
if node.nodeDesc.gpu != Level.NONE:
allRequirements.extend(['!"*loc*"', 'Wkst'])
if node.nodeDesc.ram == Level.INTENSIVE:
allRequirements.append('@.mem>30')
allRequirements = self.config.get('BASE', [])
allRequirements.extend(self.config['CPU'].get(node.nodeDesc.cpu.name, []))
allRequirements.extend(self.config['RAM'].get(node.nodeDesc.ram.name, []))
allRequirements.extend(self.config['GPU'].get(node.nodeDesc.gpu.name, []))
task = simpleFarm.Task(
name=node.nodeType,
@ -48,7 +50,7 @@ class SimpleFarmSubmitter(BaseSubmitter):
nodeName=node.name, meshroomFile=meshroomFile, parallelArgs=parallelArgs),
tags=tags,
rezPackages=[self.MESHROOM_PACKAGE],
requirements={'service': ','.join(allRequirements)},
requirements={'service': str(','.join(allRequirements))},
**arguments)
return task