Skip to content

Commit a4ffad7

Browse files
authored
Merge pull request #3078 from alicevision/bugfix/issues_with_pytest_through_rez
[tests] Fix test_submit when launched through a rez env
2 parents b55440c + 2b8435f commit a4ffad7

2 files changed

Lines changed: 9 additions & 5 deletions

File tree

meshroom/submitters/localFarmSubmitter.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,7 @@ class LocalFarmSubmitter(BaseSubmitter):
204204

205205
dryRun = False
206206
environment = {}
207+
disabled_rez = False
207208

208209
def __init__(self, parent=None):
209210
super().__init__(parent=parent)
@@ -235,13 +236,13 @@ def getChunks(chunkParams) -> list[Chunk]:
235236
it = [Chunk(i, item[0], item[-1]) for i, item in enumerate(slices) if i not in ignoreIterations]
236237
return it
237238

238-
@staticmethod
239-
def getExpandWrappedCmd(cmdArgs, rezPackages):
239+
def getExpandWrappedCmd(self, cmdArgs, rezPackages):
240240
# Wrap with create_chunks
241241
cmdBin = wrapMeshroomBin("meshroom_createChunks")
242242
cmd = f"{cmdBin} --submitter LocalFarm {cmdArgs}"
243243
# Wrap with rez
244-
cmd = rezWrapCommand(cmd, otherRezPkg=rezPackages)
244+
if not self.disabled_rez:
245+
cmd = rezWrapCommand(cmd, otherRezPkg=rezPackages)
245246
return cmd
246247

247248
def __createChunkTasks(self, job: Job, parentTask: Task, children: List[Task], chunkParams: dict) -> Task:
@@ -253,7 +254,8 @@ def __createChunkTasks(self, job: Job, parentTask: Task, children: List[Task], c
253254
meta["iteration"] = c.iteration
254255
cmdBin = wrapMeshroomBin("meshroom_compute")
255256
cmd = f"{cmdBin} {cmdArgs} --iteration {c.iteration}"
256-
cmd = rezWrapCommand(cmd, otherRezPkg=self.reqPackages)
257+
if not self.disabled_rez:
258+
cmd = rezWrapCommand(cmd, otherRezPkg=self.reqPackages)
257259
chunkTask = Task(name=name, command=cmd, metadata=meta, env=self.jobEnv)
258260
job.addTask(chunkTask)
259261
for child in children:
@@ -286,7 +288,8 @@ def createTask(self, meshroomFile: str, node) -> CreatedTask:
286288
else:
287289
cmdBin = wrapMeshroomBin("meshroom_compute")
288290
cmd = f"{cmdBin} {cmdArgs} --iteration 0"
289-
cmd = rezWrapCommand(cmd, otherRezPkg=self.reqPackages)
291+
if not self.disabled_rez:
292+
cmd = rezWrapCommand(cmd, otherRezPkg=self.reqPackages)
290293
task = Task(name=node.name, command=cmd, metadata=metadata, env=self.jobEnv)
291294
task = CreatedTask(task, None)
292295

tests/test_submit.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ def processSubmit(node: Node, graph, tmp_path):
7676
try:
7777
print(f"submit {node}")
7878
submitter = get_submitter()
79+
submitter.disabled_rez = True
7980
submitter.setFarmPath(tmp_path)
8081
submitter.setJobEnv(getJobEnv())
8182
nodesToProcess, edgesToProcess = [node], []

0 commit comments

Comments
 (0)