Replies: 1 comment
|
Per our offline discussions, I support this design. Here are my answers to the questions:
|
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Summary
This proposal adds a first end-to-end path that translates Python source into an ordinary Texera workflow of Python UDF operators. It reuses the existing compiler kernel and its working source model, dependency analysis, checking, realization, and rendering algorithms. The implementation is a smaller modular composition of that compiler, not a second compiler and not a rewrite from scratch.
The initial boundary is about where the compiler may split a program, not which normal Python statements a user may write.
What the compiler does
The user-facing pipeline has four stable stages:
An evaluation atom is simply a set of program operations that cannot be separated safely. The initial composition closes those atoms under each complete top-level statement. Therefore the smallest placement unit visible to the grouping strategy is one complete statement.
Statement-level does not mean straight-line-only
Control flow, functions, and classes are not rejected merely because of their syntax. A complete top-level
if,for,while,try,with, function definition, or class definition is admitted as one opaque placement unit. Python executes its body normally inside one generated operator.What is deferred is decomposing the interior of those statements across multiple operators. Future modules may add the dependency and execution protocols required to split loops, calls, exceptions, or recursion without changing the grouping interface, checker, renderer, or workflow builder.
Invalid Python still fails during parsing, and a proposed operator boundary still fails verification when no registered realization can implement it.
Example
Given:
the initial placement units are:
A grouping strategy may propose:
Verification then proves whether the value required downstream can cross from A to B. If it can, the selected boundary realization emits explicit export/import actions. If it cannot, that cut is illegal and a coarser legal grouping must be selected. The compiler never splits
S2or invents transport as a repair.Conceptually, the generated workflow is:
Deterministic grouping strategies
The same analyzed program can be compiled with either strategy:
K = min(statement_count, ceil(sqrt(physical_LOC)))and chooses deterministic contiguous, acyclic groups close to equal physical-LOC partitions.
Neither strategy may override dependency, transport, or realizability constraints. One authoritative checker certifies the final proposal.
Internal architecture
The forest retains exact Python source and structural information. The dependence graph records which operations produce and consume semantic values. The statement placement view is the only solver-facing projection. The checker owns final legality. Realizations explain how certified local code and boundaries are materialized. The renderer only composes already-certified projections.
Boundary transport and Amber integration
PythonValueboundary realization determines exactly which required values cross each operator boundary.MOSAIC owns source semantics, dependency analysis, grouping, and realization selection. Amber/PyTexera owns generic execution and transport primitives; it remains unaware of MOSAIC-specific atoms, carriers, colors, or solver rules.
Extensibility rule
Optional capabilities are installed as modules with explicit dependencies and contributions. A provider and the projector that interprets its facts are owned together. Adding support for distributed loops, calls, exceptions, files, consoles, or resources must add analysis evidence and/or a boundary method while preserving the same four-stage pipeline.
Feature-specific conditionals must not be scattered through dependence-graph construction, checking, or rendering, and no module may introduce a second authoritative graph, checker, or renderer.
End-to-end result: Wine classification
The current MVP was exercised with a realistic scikit-learn Wine classification program. This is the actual compiler input and the generated Python UDF code below is copied from the resulting Texera workflow JSON.
Wine input program
The generated DAG exposes parallel branches where the statement dependencies permit them and joins those branches through ordinary Texera input ports. Port labels use the producer identifier (for example,
001,004, and007) rather than internal operator class names.Representative generated UDFs
These are complete
codefields from three operators in the generated workflow: the initial Wine loader, a two-input training/preprocessing operator, and the terminal reporting operator.UDF 001 — imports and dataset loading
UDF 004 — dependency join, train/test split, and export
UDF 008 — terminal reporting
This example demonstrates compilation and workflow construction. Runtime performance claims require separate controlled execution measurements and are not inferred from the graph shape.
Validation plan
The initial implementation will cover:
Non-goals
This first integration does not distribute the interior of control-flow statements, functions, classes, recursion, exceptions, or individual expressions. It also excludes ML-based grouping, whole-namespace transport, and an Amber engine redesign.
The existing complex-case compiler work remains the reference for later modules. It is not being discarded or reimplemented.
Questions for review
All reactions