Label reflex child processes in `ps` (e.g. `reflex run [compiler]`)
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
- #7655 de @Akarshkushwaha — cerrado sin fusionar
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- Medio día
- Aptitud para principiantes
- 72/100
- Tipo de issue
- Nueva funcionalidad
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Stack tecnológico
- python
- Área
- backend, developer-experience
Línea de trabajo
Start with _compile_app_worker in reflex/reflex.py, the Granian(...) constructions in reflex/utils/exec.py, and the dependency in pyproject.toml. Add process titles for the compiler and relevant Granian services, then check uv run python scripts/check_min_deps.py and add the proposed helper tests, news fragment, and deployment documentation sentence. Done when child processes show their roles in process listings and every Granian construction passes an explicit title.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Describe the Enhancement you want
When reflex run starts, it spawns several child processes (the compiler worker, the Granian backend supervisor and its workers). They inherit the parent's command line, so ps auxww shows a wall of identical reflex run --frontend-port=3000 ... lines (or, with the spawn/forkserver start method, an unreadable python -c from multiprocessing.spawn import spawn_main; ... line). It would be much easier to tell them apart if each child set its own process title with a suffix naming its role:
root 5833 /usr/local/bin/python /usr/local/bin/reflex run --frontend-port=3000 --backend-port=8000 --loglevel=error
root 5853 /usr/local/bin/python /usr/local/bin/reflex run [compiler]
root 5916 /usr/local/bin/bun run dev
root 5917 node /home/user/app/.web/node_modules/.bin/react-router dev --host
root 5924 /usr/local/bin/python /usr/local/bin/reflex run [backend]
root 5925 /usr/local/bin/python /usr/local/bin/reflex run [backend] worker-1
- Which feature do you want to improve?
reflex run/reflex run --env prodprocess management. - What is the benefit? Debugging and ops:
ps,top,htopand container process views immediately show which process is the compiler, the backend supervisor, or a worker, and which one is burning CPU or memory.
Where the processes come from
| Child | Spawned from | Mechanism | What ps shows today |
|---|---|---|---|
| Compiler | reflex/reflex.py _compile_app |
ProcessPoolExecutor(max_workers=1); start method is fork, forkserver or spawn depending on platform / REFLEX_BACKEND_START_METHOD |
fork: parent's full command line; spawn/forkserver: python -c from multiprocessing.spawn ... |
| Backend supervisor + workers (dev and prod) | reflex/utils/exec.py run_granian_backend, run_granian_backend_prod, run_frontend_prod |
Granian Server.serve(), workers via multiprocessing |
same as above, by start method |
| Backend, legacy uvicorn/gunicorn path (only when uvicorn is installed) | run_uvicorn_backend, run_uvicorn_backend_prod |
uvicorn reload supervisor (spawn) or python -m gunicorn |
python -c ... / python -m gunicorn ... |
| Frontend dev server | exec.py run_process_and_launch_url via processes.new_process |
subprocess.Popen(["bun", "run", "dev"]); bun then spawns node .../react-router dev --host |
already self-describing |
Proposed implementation
Granian already supports this. granian.server.Server(process_name=...) sets the supervisor's title to process_name and each worker's title to f"{process_name} worker-{n}". It only needs the granian[pname] extra, which is the setproctitle package (prebuilt wheels for every CPython reflex supports, including 3.14). Without the extra, passing process_name raises ConfigurationError, so the dependency has to be unconditional rather than optional.
- In
pyproject.toml, changegranian[reload] >=2.7.4togranian[reload,pname] >=2.7.4. Check thatuv run python scripts/check_min_deps.pystill passes. - Add a small helper in
reflex/utils/processes.py(orexec.py), e.g.set_process_title(label: str), that builds a title such asf"{sys.executable} {Path(sys.argv[0]).name} run [{label}]"and callssetproctitle.setproctitle(...). Keep thesetproctitleimport inside this one helper. Note thatsetproctitlereplaces the whole title rather than appending, and under spawn the child's own argv is the-cbootstrap line, so constructing the title from scratch is the right approach for every start method. - Call the helper at the top of
_compile_app_workerinreflex/reflex.pywith the labelcompiler. This function already runs inside the child. (Verified: with this call, fork, forkserver and spawn all show.../python3 reflex run [compiler].) - Pass
process_name=to the threeGranian(...)constructions inreflex/utils/exec.py: the dev backend (ParentBoundGranianinrun_granian_backend),run_granian_backend_prod, and the prod static frontend server (run_frontend_prod, which callsrun_granian_backend_prodwith its ownapp_target). Use labels likebackendandfrontend; Granian then names workersreflex run [backend] worker-1. - Add a news fragment (
news/+process-titles.feature.md), a unit test for the helper and for_compile_app_worker(monkeypatchsetproctitle), and a sentence in the deployment docs mentioning thatpsshows labeled processes.
Important: once setproctitle is importable, Granian's default title also changes, to granian asgi 0.0.0.0:8000 app:module for the supervisor and ... worker-1 for workers. So every Granian(...) call in reflex must pass process_name, otherwise the output changes in an unintended way.
Out of scope / caveats
- bun / node frontend processes cannot be labeled from outside.
exec -a "bun [frontend]" bun run devdoes change argv[0] of the bun process on POSIX, but it needs a shell wrapper, does nothing for thenode react-router devgrandchild (which is the one that actually uses CPU), and has no Windows equivalent.bun run devis already recognisable, so leave it alone. Appending a literal[frontend]argument is not safe either, sincebun run devforwards extra arguments to the script. - The legacy uvicorn dev reload worker's only reflex-controlled entry point is the app factory, so labeling it would be hacky. Skip it. gunicorn in prod labels its own master and workers once
setproctitleis installed. prctl(PR_SET_NAME)only changes the 15-charactercommfield, not theargscolumn, so it is not a substitute.- macOS:
setproctitleworks andpsshows the title; Activity Monitor keeps the original name. - Windows:
setproctitleonly sets the console window title; the command line in Task Manager is unchanged. Harmless, no gating needed, but no visible benefit. - On Linux the title is written over the original argv + environ block and is truncated beyond it.
reflex run [compiler]is shorter than any realistic original command line, so this is not a practical concern.
Estimated effort: about half a day including tests.
- Lenguaje dominante
- Python
- Estrellas
- 29k
- Forks
- 1.8k
- Merge medio
- 3 d 5 h
- PR fusionados (30 d)
- 182
Preparar el entorno
Inicia el contenedor de desarrollo del proyecto en tu navegador, con tu propia cuenta de GitHub.
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de reflex-dev/reflex
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 78/100
reflex-dev/reflex#8026 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Kept env.py failure: the "move it aside" hint is dropped and a full traceback is logged when alembic.ini uses a relative script_locationPosiblemente ocupada @MaiAditya la tomó hace 13 días. Abiertobug release-train
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
reflex-dev/reflex#7856 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
0.9.12 changelog follow-ups: the #7132 "_get_was_touched" entry describes unreachable behaviour, #7115's hasattr/getattr change is undocumented, #7131's wordingQuizá libre de nuevo Un pull request para esta issue se cerró sin fusionarse. Abiertorelease-train
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
reflex-dev/reflex#7260 · 2 comentarios ·
Los mantenedores suelen responder en 1 día
-
ClientStateVar: a component that mounts while the value is non-default never re-renders on the push back to the defaultQuizá libre de nuevo Un pull request para esta issue se cerró sin fusionarse. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
reflex-dev/reflex#6823 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
documentation upstream
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
reflex-dev/reflex#6436 · 3 comentarios ·
Los mantenedores suelen responder en 1 día
Todos los issues de reflex-dev/reflex
Issues similares
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 86/100
superlinked/sie#1033 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
apache/ponymail-foal#365 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 79/100
NousResearch/hermes-labs-plugins#116 ·
Los mantenedores suelen responder en 2 días
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 77/100
gcivil-nyu-org/team-3-fall26#192 ·
Los mantenedores suelen responder en 1 día
-
[Study plan] Study sessions can be rescheduled to any length (e.g. 72 hours) with no length checkAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
gcivil-nyu-org/team-2-fall26#159 ·
Los mantenedores suelen responder en 1 día