The GitHub Actions job "Required Checks" on 
texera.git/gh-readonly-queue/main/pr-8770-bb470cd77c2e191c17574a0722d15f315f29c11f
 has failed.
Run started by GitHub user Xiao-zhen-Liu (triggered by Xiao-zhen-Liu).

Head commit for run:
23c0e5a1882de7c564cdbe093d5a89649a47e1b4 / Suryaa Charan 
<[email protected]>
feat(workflow-operator): make Python UDF templates work after uncommenting one 
class (#8770)

### What changes were proposed in this PR?

The Python UDF, 2-in Python UDF and 1-out Python UDF templates were
fully commented out, including `from pytexera import *`. They also never
said to keep only one class. So uncommenting a class failed with
`NameError`, and keeping several failed the one-Operator check.

- `from pytexera import *` is now active.
- A short header explains the rules:

```python
# Keep exactly ONE class below: uncomment it and delete the others.
# Its method must match its base class:
#   UDFOperatorV2 -> process_tuple, UDFBatchOperator -> process_batch,
#   UDFTableOperator -> process_table
# Always `yield` results (never `return` a value). Put setup code in open();
# if you override __init__, call super().__init__() first.
```

- The 2-in template also says that port 0 (model) is read before port 1
(tuples).
- The UiParameter lines are kept.
- The template copies in
`docs/reference/operators/user-defined-functions/python/` are synced.

Saved workflows keep their own code and are not affected.

Before, every line started with `#`:

```python
# Choose from the following templates:
# ...
# from pytexera import *
#
# class ProcessTupleOperator(UDFOperatorV2):
# ...
```

After, in the code editor:

<img width="630" height="388" alt="template-after"
src="https://github.com/user-attachments/assets/d376eb72-a40e-4493-9018-21c2b089ca9e";
/>


### Any related issues, documentation, discussions?

Part of #8736. Split out of #8737.

### How was this PR tested?

- The specs for all three descriptors read the `defaultValue`. They
check that the import is the only active line and the header is there,
and that uncommenting any one class leaves exactly one active class.
- New Python tests load the template shape and check that uncommenting
each class loads without adding an import.
- The template copy in the notebook-migration prompt is updated to
match.

```
sbt "WorkflowOperator/testOnly org.apache.texera.amber.operator.udf.python.*" 
"WorkflowOperator/scalafmtCheck" "WorkflowOperator/Test/scalafmtCheck"
cd amber && pytest -m "not integration" 
src/test/python/core/architecture/managers/test_executor_manager.py
cd frontend && yarn eslint 
src/app/workspace/service/notebook-migration/migration-prompts.ts
```

### Was this PR authored or co-authored using generative AI tooling?

Generated-by: Claude Code (Claude Opus 5.5)

---------

Co-authored-by: suryaacharan <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>

Report URL: https://github.com/apache/texera/actions/runs/38785117315

With regards,
GitHub Actions via GitBox

Reply via email to