Проблема: ghcr.io/fission/python-env v3 вызывает userfunc() без аргументов. Пользователи пишут def main(event, context) (AWS Lambda стиль) — получают: TypeError: main() missing 2 required positional arguments: 'event' and 'context' Это НЕ ошибка пользователя. Fission просто не реализует Lambda-конвенцию. demo.py: временно исправлен на event=None, context=None. План: собрать naeel/console-python-env с патчем inspect.signature чтобы любая сигнатура main() работала автоматически. Подробнее: doc/plans/console-python-env-fix-2026-05-04.md
44 lines
1.5 KiB
Markdown
44 lines
1.5 KiB
Markdown
# Plan: console-python-env — fix function call signature
|
|
|
|
Date: 2026-05-04
|
|
|
|
## Problem
|
|
|
|
Fission Python env v3 calls user function as `userfunc()` with no arguments
|
|
(Flask URL path params only, empty for parameterless routes).
|
|
|
|
Users writing `def main(event, context)` (AWS Lambda style) get:
|
|
```
|
|
TypeError: main() missing 2 required positional arguments: 'event' and 'context'
|
|
```
|
|
|
|
This is a real limitation of `ghcr.io/fission/python-env` — it never supported
|
|
Lambda-style signatures. The user code is valid Python, the env is inflexible.
|
|
|
|
## Solution
|
|
|
|
Build custom `naeel/console-python-env` based on `ghcr.io/fission/python-env`.
|
|
Patch `server.py`: before calling `userfunc`, use `inspect.signature` to count
|
|
required positional args, fill them with `None` if Fission passes fewer.
|
|
|
|
Supported signatures after fix:
|
|
- `def main()` — standard Fission
|
|
- `def main(event, context)` — AWS Lambda style (event=None, context=None)
|
|
- `def main(request)` — single-arg style (request=None)
|
|
- `def main(*args, **kwargs)` — variadic, works as before
|
|
|
|
## Steps
|
|
|
|
1. Get `server.py` from running pod
|
|
2. Apply inspect patch to `userfunc_call`
|
|
3. Write Dockerfile: `FROM ghcr.io/fission/python-env`, COPY patched server.py
|
|
4. Build `naeel/console-python-env:v1.0`
|
|
5. Push to Docker Hub
|
|
6. Update Environment CRD `console-python-env` in k8s → new runtime image
|
|
7. Restart poolmgr pod for that env
|
|
8. Test `aa1` with `def main(event, context)` from archive
|
|
|
|
## Documentation (after fix)
|
|
|
|
Add to user docs: supported function signatures for Fission Python env.
|