Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -555,7 +555,7 @@ public PythonToolResult execute_tool(final PurePythonTablePortObject toolTable,

@Override
public CombinedToolsWorkflowInfo init_combined_tools_workflow(final List<PythonPortObject> inputs,
final String execMode) {
final String execMode, final boolean removeFailedTools) {
throw new UnsupportedOperationException(
"Initializing a combined tools workflow is not supported here.");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,8 @@ public PythonToolResult execute_tool(final PurePythonTablePortObject toolTable,

@Override
public CombinedToolsWorkflowInfo init_combined_tools_workflow(final List<PythonPortObject> inputs,
final String execMode) {
return m_toolExecutor.initCombinedToolsWorkflow(inputs, execMode);
final String execMode, final boolean removeFailedTools) {
return m_toolExecutor.initCombinedToolsWorkflow(inputs, execMode, removeFailedTools);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ PythonToolResult executeTool(final PurePythonTablePortObject pythonToolTable, fi
}

CombinedToolsWorkflowInfo initCombinedToolsWorkflow(final List<PythonPortObject> inputs,
final String execModeString) {
final String execModeString, final boolean removeFailedTools) {
m_fileStoreSwitcher.switchFileStoreHandler(m_nodeContainer, false);

Map<String, FileStore> dummyFileStoreMap = Map.of();
Expand All @@ -194,7 +194,7 @@ CombinedToolsWorkflowInfo initCombinedToolsWorkflow(final List<PythonPortObject>
.toArray(PortObject[]::new);
m_workflowExecutor =
WorkflowSegmentExecutor.builder(m_nodeContainer, execMode, "Combined tools workflow", warning -> {
}, m_exec, false).combined(inputPortObjects).build();
}, m_exec, false).combined(inputPortObjects).removeFailedSegments(removeFailedTools).build();
var combinedToolsWorkflowId = m_workflowExecutor.getWorkflow().getID();
m_disposeCombinedToolsWorkflowOnClose = true;
m_combinedToolsWorkflow = new VirtualProject(combinedToolsWorkflowId);
Expand All @@ -203,7 +203,8 @@ CombinedToolsWorkflowInfo initCombinedToolsWorkflow(final List<PythonPortObject>
} else {
m_workflowExecutor =
WorkflowSegmentExecutor.builder(m_nodeContainer, execMode, "Combined tools workflow", warning -> {
}, m_exec, false).combined(m_combinedToolsWorkflow.loadAndGetWorkflow()).build();
}, m_exec, false).combined(m_combinedToolsWorkflow.loadAndGetWorkflow())
.removeFailedSegments(removeFailedTools).build();
assert inputs.isEmpty();
inputPortIds = List.of();
}
Expand Down Expand Up @@ -411,8 +412,7 @@ private static WorkflowSegment createWorkflowSegmentWithRemovedIONodes(final Wor
segmentWfm = createEmptyWorkflow("workflow_segment");
var copyContent = WorkflowCopyContent.builder()
.setNodeIDs(wfm.getNodeContainers().stream().map(NodeContainer::getID).toArray(NodeID[]::new)).build();
var persistor = wfm.copy(copyContent);
segmentWfm.paste(persistor);
segmentWfm.copyFromAndPasteHere(wfm, copyContent);
List<Input> inputs = new ArrayList<>();
List<Output> outputs = new ArrayList<>();
removeAndCollectContainerInputsAndOutputs(segmentWfm, inputs, inputIds, outputs, outputIds);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,12 @@ public record CombinedToolsWorkflowInfo(String projectId, String workflowId, Lis
* Initializes the combined-tools workflow for the given inputs.
*
* @param inputs the source inputs of the combined-tools workflow
* @param execMode DEFAUTL, DETACHED or DEBUG
* @param execMode DEFAULT, DETACHED or DEBUG
* @param removeFailedTools whether to remove failed tools from the combined workflow
* @return info about the initialized combined-tools workflow
*/
CombinedToolsWorkflowInfo init_combined_tools_workflow(List<PythonPortObject> inputs, String execMode);
CombinedToolsWorkflowInfo init_combined_tools_workflow(List<PythonPortObject> inputs, String execMode,
boolean removeFailedTools);

/**
* @return the combined-tools workflow as a Python port object
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1473,13 +1473,15 @@ def execute_tool(self, tool, parameters: dict, inputs: List, execution_hints: di

return result.message(), outputs, result.viewNodeIds()

def init_combined_tools_workflow(self, inputs: List, execution_mode: str):
def init_combined_tools_workflow(
self, inputs: List, execution_mode: str, remove_failed_tools: bool
):
prepared_inputs = []
for input in inputs:
prepared_input = self._type_registry.table_from_python(input)
prepared_inputs.append(prepared_input)
result = self._java_ctx.init_combined_tools_workflow(
prepared_inputs, execution_mode
prepared_inputs, execution_mode, remove_failed_tools
)
return result.projectId(), result.workflowId(), result.inputPortIds()

Expand Down