Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[minor] renderfarm submission with rez #1629

Merged
merged 2 commits into from
Feb 22, 2022
Merged
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 meshroom/submitters/simpleFarmConfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
},
"GPU": {
"NONE": [],
"NORMAL": ["!\"*rnd*\""],
"INTENSIVE": ["!\"*rnd*\"", "@.nCPUs>=12"]
"NORMAL": ["cuda8G"],
"INTENSIVE": ["cuda16G"]
}
}
38 changes: 32 additions & 6 deletions meshroom/submitters/simpleFarmSubmitter.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

import os
import json
import logging

import simpleFarm
from meshroom.core.desc import Level
Expand All @@ -12,14 +13,12 @@
binDir = os.path.dirname(os.path.dirname(os.path.dirname(currentDir)))

class SimpleFarmSubmitter(BaseSubmitter):
if 'REZ_MESHROOM_VERSION' in os.environ:
MESHROOM_PACKAGE = "meshroom-{}".format(os.environ.get('REZ_MESHROOM_VERSION', ''))
else:
MESHROOM_PACKAGE = None

filepath = os.environ.get('SIMPLEFARMCONFIG', os.path.join(currentDir, 'simpleFarmConfig.json'))
config = json.load(open(filepath))

reqPackages = []
environment = {}
ENGINE = ''
DEFAULT_TAGS = {'prod': ''}

Expand All @@ -28,6 +27,32 @@ def __init__(self, parent=None):
self.engine = os.environ.get('MESHROOM_SIMPLEFARM_ENGINE', 'tractor')
self.share = os.environ.get('MESHROOM_SIMPLEFARM_SHARE', 'vfx')
self.prod = os.environ.get('PROD', 'mvg')
if 'REZ_REQUEST' in os.environ:
packages = os.environ.get('REZ_REQUEST', '').split()
resolvedPackages = os.environ.get('REZ_RESOLVE', '').split()
resolvedVersions = {}
for r in resolvedPackages:
# remove implict packages
if r.startswith('~'):
continue
# logging.info('REZ: {}'.format(str(r)))
v = r.split('-')
# logging.info(' v: {}'.format(str(v)))
if len(v) == 2:
resolvedVersions[v[0]] = v[1]
for p in packages:
if p.startswith('~'):
continue
v = p.split('-')
self.reqPackages.append('-'.join([v[0], resolvedVersions[v[0]]]))
logging.debug('REZ Packages: {}'.format(str(self.reqPackages)))
elif 'REZ_MESHROOM_VERSION' in os.environ:
self.reqPackages = ["meshroom-{}".format(os.environ.get('REZ_MESHROOM_VERSION', ''))]
else:
self.reqPackages = None

if 'REZ_DEV_PACKAGES_ROOT' in os.environ:
self.environment['REZ_DEV_PACKAGES_ROOT'] = os.environ['REZ_DEV_PACKAGES_ROOT']

def createTask(self, meshroomFile, node):
tags = self.DEFAULT_TAGS.copy() # copy to not modify default tags
Expand All @@ -50,10 +75,10 @@ def createTask(self, meshroomFile, node):
task = simpleFarm.Task(
name=node.nodeType,
command='{exe} --node {nodeName} "{meshroomFile}" {parallelArgs} --extern'.format(
exe='meshroom_compute' if self.MESHROOM_PACKAGE else os.path.join(binDir, 'meshroom_compute'),
exe='meshroom_compute' if self.reqPackages else os.path.join(binDir, 'meshroom_compute'),
nodeName=node.name, meshroomFile=meshroomFile, parallelArgs=parallelArgs),
tags=tags,
rezPackages=[self.MESHROOM_PACKAGE] if self.MESHROOM_PACKAGE else None,
rezPackages=self.reqPackages,
requirements={'service': str(','.join(allRequirements))},
**arguments)
return task
Expand All @@ -74,6 +99,7 @@ def submit(self, nodes, edges, filepath):
job = simpleFarm.Job(name,
tags=mainTags,
requirements={'service': str(','.join(allRequirements))},
environment=self.environment,
)

nodeNameToTask = {}
Expand Down