2828from meshroom .core .graphIO import GraphIO
2929
3030from meshroom .core .taskManager import TaskManager
31+ from meshroom .core .submitter import jobManager
3132
3233from meshroom .core .node import NodeChunk , Node , Status , ExecMode , CompatibilityNode , Position
3334from meshroom .core import submitters , MrNodeType
@@ -377,6 +378,7 @@ def __init__(self, undoStack: commands.UndoStack, taskManager: TaskManager, pare
377378 self ._sortedDFSChunks : QObjectListModel = QObjectListModel (parent = self )
378379 self ._layout : GraphLayout = GraphLayout (self )
379380 self ._selectedNode = None
381+ self ._selectedChunk = None
380382 self ._nodeSelection : QItemSelectionModel = QItemSelectionModel (self ._graph .nodes , parent = self )
381383 self ._hoveredNode = None
382384
@@ -561,7 +563,7 @@ def stopExecution(self):
561563 return
562564 self ._taskManager .requestBlockRestart ()
563565 self ._graph .stopExecution ()
564- self ._taskManager ._thread . wait ()
566+ self ._taskManager .join ()
565567
566568 @Slot (Node )
567569 def stopNodeComputation (self , node ):
@@ -572,7 +574,7 @@ def stopNodeComputation(self, node):
572574
573575 # Stop the node and wait Task Manager
574576 node .stopComputation ()
575- self ._taskManager ._thread . wait ()
577+ self ._taskManager .join ()
576578
577579 @Slot (Node )
578580 def cancelNodeComputation (self , node ):
@@ -608,13 +610,12 @@ def stopTask(self, chunk: NodeChunk):
608610 if self .isChunkComputingLocally (chunk ):
609611 print (f"-> is local" )
610612 chunk .stopProcess ()
611- chunk .upgradeStatusTo (Status .STOPPED )
612- # TODO : remove the chunk from the thread process
613- self ._taskManager ._thread .wait ()
613+ # Remove the chunk from the thread process
614+ self ._taskManager ._cancelledChunks .append (chunk )
614615 elif self .isChunkComputingExternally (chunk ):
615- print ( "[UIGraph] (stopTask) Stop task is not implemented for " )
616- # TODO
617- pass
616+ jobManager . stopChunkTask ( chunk )
617+ chunk . upgradeStatusTo ( Status . STOPPED )
618+ chunk . stopProcess ()
618619
619620 @Slot (NodeChunk )
620621 def pauseTask (self , chunk : NodeChunk ):
@@ -1319,6 +1320,9 @@ def canSubmitNode(self, node: Node) -> bool:
13191320 selectedNodeChanged = Signal ()
13201321 # Current main selected node
13211322 selectedNode = makeProperty (QObject , "_selectedNode" , selectedNodeChanged , resetOnDestroy = True )
1323+ # Current chunk selected (used to send signals from TaskManager to ChunksListView)
1324+ selectedChunkChanged = Signal ()
1325+ selectedChunk = makeProperty (QObject , "_selectedChunk" , selectedChunkChanged , resetOnDestroy = True )
13221326
13231327 nodeSelection = makeProperty (QObject , "_nodeSelection" )
13241328
0 commit comments