[ui] add partial graph submission up to a certain node

This commit is contained in:
Yann Lanthony 2018-02-07 14:35:50 +01:00
parent 907c9cbcba
commit 25992286d0
4 changed files with 21 additions and 7 deletions

View file

@ -1812,8 +1812,7 @@ def execute(graph, toNodes=None, forceCompute=False, forceStatus=False):
node.endSequence()
def submitGraph(graph, submitter, toNode=None):
toNodes = graph.findNodes([toNode]) if toNode else None
def submitGraph(graph, submitter, toNodes=None):
nodesToProcess, edgesToProcess = graph.dfsToProcess(startNodes=toNodes)
flowEdges = graph.flowEdges(startNodes=toNodes)
edgesToProcess = set(edgesToProcess).intersection(flowEdges)
@ -1843,5 +1842,6 @@ def submit(graphFile, submitter, toNode=None):
Submit the given graph via the given submitter.
"""
graph = loadGraph(graphFile)
submitGraph(graph, submitter, toNode)
toNodes = graph.findNodes([toNode]) if toNode else None
submitGraph(graph, submitter, toNodes)

View file

@ -179,11 +179,18 @@ class UIGraph(QObject):
self._computeThread.join()
self.computeStatusChanged.emit()
@Slot()
def submit(self):
""" Submit the whole graph to the default Submitter. """
@Slot(graph.Node)
def submit(self, node=None):
""" Submit the graph to the default Submitter.
If a node is specified, submit this node and its uncomputed predecessors.
Otherwise, submit the whole graph.
Notes:
Default submitter is specified using the MESHROOM_DEFAULT_SUBMITTER environment variable.
"""
self.save() # graph must be saved before being submitted
graph.submitGraph(self._graph, os.environ.get('MESHROOM_DEFAULT_SUBMITTER', ''))
node = [node] if node else None
graph.submitGraph(self._graph, os.environ.get('MESHROOM_DEFAULT_SUBMITTER', ''), node)
def onChunkStatusChanged(self, chunk, status):
# update graph computing status

View file

@ -229,6 +229,7 @@ Item {
onDoubleClicked: root.nodeDoubleClicked(node)
onComputeRequest: uigraph.execute(node)
onSubmitRequest: uigraph.submit(node)
onRemoveRequest: uigraph.removeNode(node)
Keys.onDeletePressed: uigraph.removeNode(node)

View file

@ -15,6 +15,7 @@ Item {
signal attributePinCreated(var attribute, var pin)
signal computeRequest()
signal submitRequest()
signal removeRequest()
implicitHeight: body.height
@ -40,6 +41,11 @@ Item {
enabled: !root.readOnly
onTriggered: root.computeRequest()
}
MenuItem {
text: "Submit"
enabled: !root.readOnly
onTriggered: root.submitRequest()
}
MenuItem {
text: "Open Folder"
onTriggered: Qt.openUrlExternally(node.internalFolder)