tools: agent_simulator.py --labs N to spread simulated agents over several labs

クローズ
#72 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

@adity982 がすでに取り組んでいます。

2026年10月14日 から。

  • #170 @adity982 による — オープン

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
66/100
issue の種類
機能追加
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
fastapi, python
領域
backend, cli

調査の方向性

Start with tools/agent_simulator.py and its existing argument parsing, JWT handling, and agent enrollment flow; then read Backend/system_routes.py and Backend/pops/routers/agents.py to understand token creation and lab assignment. Use docs/api.md and section 9 of docs/kapasite/README.md as references, and test only against a throwaway server and database. Done means the acceptance criteria pass, including the four-lab 100-agent distribution, help text, and flake8 tools/.

索引モデルが issue の本文から書いたものです。

説明

enhancement good first issue

Context

tools/agent_simulator.py runs N fake agents against a test server (load tests, docs/kapasite/README.md). With --enroll-token every simulated agent uses the same token, so all of them land in one lab (or in Atanmamis_Cihazlar without a token). Pages and reports that group by lab (Sınıflar, Raporlar, lab targets in İşlemler) cannot be tried with a realistic spread.

An enrollment token can be bound to a lab: POST /api/system/enroll-token with {"lab_name": ..., "max_uses": ..., "ttl_hours": ...} (superadmin, see Backend/system_routes.py and docs/api.md). A device that enrolls with such a token is put in that lab (Backend/pops/routers/agents.py).

What to do

Add --labs N to the simulator:

  • With --labs N (and a superadmin JWT in --jwt or POPS_SIM_JWT, which the simulator already reads), create N enrollment tokens through the API, bound to labs SIM-LAB-1 … SIM-LAB-N, with a short lifetime and enough uses for the agents of each lab.
  • Agent i uses the token of lab i % N.
  • Print how many agents enrolled per lab at the end.

Acceptance criteria

  • --labs defaults to 0, and without it the simulator behaves exactly as today.
  • --labs together with --enroll-token, or without a JWT, stops with a clear argparse error.
  • After a run with --n 100 --labs 4, Sınıflar shows four SIM-LAB-* labs with 25 agents each.
  • The module docstring and --help describe the option, with an example.
  • Standard library and websockets only; runs on Python 3.10; flake8 tools/ is clean (CI checks it).
  • Tested against a throwaway server and database only, as described in section 9 of docs/kapasite/README.md, never against a real server.
主要言語
Python
スター
1
フォーク
2
平均マージ
9時間 3分
マージ済み PR(30日)
140

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

PashaCore/POps のほかの issue

PashaCore/POps の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。