Skip to content

Commit

Permalink
Merge pull request #1426 from alicevision/dev/singleChunk
Browse files Browse the repository at this point in the history
No cmd line range arguments if we have only a single chunk
  • Loading branch information
fabiencastan authored May 28, 2021
2 parents 81fe0d5 + 90f184d commit c8dde8e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
2 changes: 1 addition & 1 deletion meshroom/core/desc.py
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,7 @@ def buildCommandLine(self, chunk):
if not alreadyInEnv:
cmdPrefix = '{rez} {packageFullName} -- '.format(rez=os.environ.get('REZ_ENV'), packageFullName=chunk.node.packageFullName)
cmdSuffix = ''
if chunk.node.isParallelized:
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

Expand Down
18 changes: 12 additions & 6 deletions meshroom/ui/graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

from meshroom.core.taskManager import TaskManager

from meshroom.core.node import NodeChunk, Node, Status, CompatibilityNode, Position
from meshroom.core.node import NodeChunk, Node, Status, ExecMode, CompatibilityNode, Position
from meshroom.core import submitters
from meshroom.ui import commands
from meshroom.ui.utils import makeProperty
Expand Down Expand Up @@ -269,7 +269,7 @@ def __init__(self, undoStack, taskManager, parent=None):
self._modificationCount = 0
self._chunksMonitor = ChunksMonitor(parent=self)
self._computeThread = Thread()
self._running = self._submitted = False
self._computingLocally = self._submitted = False
self._sortedDFSChunks = QObjectListModel(parent=self)
self._layout = GraphLayout(self)
self._selectedNode = None
Expand Down Expand Up @@ -432,10 +432,10 @@ def submit(self, node=None):

def updateGraphComputingStatus(self):
# update graph computing status
running = any([ch.status.status == Status.RUNNING for ch in self._sortedDFSChunks])
computingLocally = any([ch.status.execMode == ExecMode.LOCAL and ch.status.status in (Status.RUNNING, Status.SUBMITTED) for ch in self._sortedDFSChunks])
submitted = any([ch.status.status == Status.SUBMITTED for ch in self._sortedDFSChunks])
if self._running != running or self._submitted != submitted:
self._running = running
if self._computingLocally != computingLocally or self._submitted != submitted:
self._computingLocally = computingLocally
self._submitted = submitted
self.computeStatusChanged.emit()

Expand All @@ -449,7 +449,13 @@ def isComputingExternally(self):

def isComputingLocally(self):
""" Whether this graph is being computed locally (i.e computation can be stopped). """
return self._taskManager._thread.isRunning()
## One solution could be to check if the thread is still running,
# but the latency in creating/stopping the thread can be off regarding the update signals.
# isRunningThread = self._taskManager._thread.isRunning()
## Another solution is to retrieve the current status directly from all chunks status
# isRunning = self._taskManager.hasRunningChunks()
## For performance reason, we use a precomputed value updated in updateGraphComputingStatus:
return self._computingLocally

def push(self, command):
""" Try and push the given command to the undo stack.
Expand Down

0 comments on commit c8dde8e

Please sign in to comment.