Label reflex child processes in `ps` (e.g. `reflex run [compiler]`)
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
- #7655 @Akarshkushwaha による — マージされずにクローズ
評価
- 難易度
- 3/5
- 見積もり時間
- 半日
- 初心者へのやさしさ
- 72/100
- issue の種類
- 機能追加
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- python
調査の方向性
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.
索引モデルが issue の本文から書いたものです。
説明
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.
- 主要言語
- Python
- スター
- 29k
- フォーク
- 1.8k
- 平均マージ
- 3日 5時間
- マージ済み PR(30日)
- 182
環境構築
このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
reflex-dev/reflex のほかの issue
-
難易度 1/5 1時間未満 初心者へのやさしさ 78/100
reflex-dev/reflex#8026 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
Kept env.py failure: the "move it aside" hint is dropped and a full traceback is logged when alembic.ini uses a relative script_location対応中かも @MaiAditya が 13 日前に担当しました。 オープンbug release-train
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
reflex-dev/reflex#7856 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
0.9.12 changelog follow-ups: the #7132 "_get_was_touched" entry describes unreachable behaviour, #7115's hasattr/getattr change is undocumented, #7131's wording再び着手できるかも このイシューのプルリクエストはマージされずにクローズされました。 オープンrelease-train
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
reflex-dev/reflex#7260 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
ClientStateVar: a component that mounts while the value is non-default never re-renders on the push back to the default再び着手できるかも このイシューのプルリクエストはマージされずにクローズされました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
reflex-dev/reflex#6823 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
documentation upstream
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
reflex-dev/reflex#6436 · コメント 3 件 ·
メンテナーはふだん 1 日以内に返信
reflex-dev/reflex の issue をすべて見る
似ている issue
-
難易度 1/5 1時間未満 初心者へのやさしさ 86/100
superlinked/sie#1033 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
apache/ponymail-foal#365 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 79/100
NousResearch/hermes-labs-plugins#116 ·
メンテナーはふだん 2 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 77/100
gcivil-nyu-org/team-3-fall26#192 ·
メンテナーはふだん 1 日以内に返信
-
[Study plan] Study sessions can be rescheduled to any length (e.g. 72 hours) with no length checkオープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
gcivil-nyu-org/team-2-fall26#159 ·
メンテナーはふだん 1 日以内に返信