Add kernel execution support for custom nodes#336
Open
Edwardvaneechoud wants to merge 4 commits intofeauture/kernel-implementationfrom
Open
Add kernel execution support for custom nodes#336Edwardvaneechoud wants to merge 4 commits intofeauture/kernel-implementationfrom
Edwardvaneechoud wants to merge 4 commits intofeauture/kernel-implementationfrom
Conversation
Add support for custom nodes to execute in kernel containers, enabling use of arbitrary Python packages beyond what Polars provides. Custom nodes can now declare required packages (spec), and at runtime users select a kernel that satisfies those requirements. Backend changes: - Add use_kernel, required_packages, kernel_code fields to CustomNodeBase - Add kernel_id to UserDefinedNode for runtime kernel selection - Split add_user_defined_node() into lazy and kernel execution paths - Add _add_user_defined_node_kernel() following add_python_script() pattern - Add _build_kernel_code_for_custom_node() for settings injection - Parse kernel fields (use_kernel, required_packages, kernel_code) in get_custom_node() route for Node Browser loading Frontend changes: - Add kernel execution toggle and required packages input to NodeDesigner - Add kernel-mode code editor with flowfile API hints - Implement dual-mode code generation (lazy vs kernel) - Add kernel-mode validation rules (flowfile.publish_output check) - Add runtime kernel selector with package matching to CustomNode.vue - Update types: NodeMetadata, CustomNodeSchema, NodeUserDefined https://claude.ai/code/session_01Sody7mJjQrzJvSrmF5HMVe
The required packages input now uses a text field + "+" button to add packages one at a time, displayed as removable tags. This avoids the issue where typing commas was consumed by the parser. https://claude.ai/code/session_01Sody7mJjQrzJvSrmF5HMVe
In kernel mode, settings are injected as plain Python variables by the runtime, so Insert Variable now emits a comment showing the variable name and type instead of self.settings_schema references. The insertion point also skips initial comments rather than searching for def process. https://claude.ai/code/session_01Sody7mJjQrzJvSrmF5HMVe
Build a SimpleNamespace-based `self` object in the kernel code so `self.settings_schema.section.field.value` works identically in both kernel and lazy modes. Flat convenience variables are kept too. The Insert Variable button now emits the same self.settings_schema pattern for both modes (no indentation in kernel mode since there's no enclosing def). https://claude.ai/code/session_01Sody7mJjQrzJvSrmF5HMVe
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds support for executing custom nodes inside Docker containers (kernels) with configurable package dependencies, while maintaining backward compatibility with the existing lazy-plan execution model.
Key Changes
Frontend
Node Designer: Added kernel execution toggle and required packages configuration UI
Custom Node Component: Implemented kernel selection UI with real-time status monitoring
Code Editor: Updated to support both execution modes
Constants & Types: Added kernel-specific defaults and type definitions
defaultKernelCodetemplate withflowfile.read_input()andflowfile.publish_output()NodeMetadataandNodeUserDefinedtypes with kernel fieldsBackend
Flow Graph: Implemented dual execution paths for custom nodes
_add_user_defined_node_lazy(): Standard lazy-plan execution (existing behavior)_add_user_defined_node_kernel(): New kernel-based execution with:ExecuteRequestCustom Node Base: Extended with kernel configuration fields
use_kernel: bool- Enable kernel execution moderequired_packages: list[str]- Docker packages to installkernel_code: str- Python code to execute in kernelCode Generation: Updated to generate appropriate node classes
kernel_codeas triple-quoted string, stubsprocess()methodprocess()method body (existing behavior)Node Designer API: Enhanced to parse and extract kernel metadata from custom node files
use_kernel,kernel_code, andrequired_packagesattributesData Models
UserDefinedNodeschema with optionalkernel_idfieldCustomNodeSchemainterface with kernel configuration fieldsImplementation Details
add_python_script: materialize inputs → send code to kernel → read outputsself.settings_schemaaccess needed)