quantcore_circuits.sim_tools.aedt_session

Where a qcc AEDT script runs: a new batch process, a new AEDT window, or an AEDT session that is already open.

aedt= (hfss.render / hfss.solve_job / runner.run_job, the tutorials’ AEDT_MODE; default from QCC_AEDT_MODE, else "batch"):

  • "batch" — a new non-graphical AEDT (ansysedt -ng -RunScriptAndExit), as before. Nothing to look at, but the progress lines (pass, mesh, ΔF / ΔS / ΔC) are printed every ~30 s.

  • "gui" — a new AEDT window (ansysedt -RunScript, no -ng): you watch the import, the mesh, the convergence plots and the results in it, and it stays open after the run (the project is saved). It is started detached, so it survives a kernel restart.

  • "attach" — run inside an AEDT 2024 R1+ window that is already open (the newest one, or aedt_pid= / QCC_AEDT_PID); if none is open, as "gui". The connection uses AEDT’s own gRPC client (<AEDT>/PythonFiles/DesktopPlugin/PyDesktopPlugin.py, shipped with AEDT 2024 R1; no extra Python package) in a small helper process, which calls oDesktop.RunScriptWithArguments(qcc_solve.py, <sim>.json) and then only releases the connection: the session, and every project in it (also the new one), stay open. The qcc script never quits AEDT, and KQC’s run_pyepr_t1_estimate.py (which does) is never run.

Rules: on a timeout only processes qcc started are killed (the batch AEDT, the gui window qcc opened, or the attach helper — never an attached session; its solve then keeps running there). A project of the same job left open by an earlier attached run is closed in that session before the new run (it would block the save).

Attributes

Classes

Functions

find_sessions([min_version]) → list[AedtSession]

AEDT processes of version ≥ min_version (batch ones too; see AedtSession.graphical), newest first.

launch_gui(executable, job_dir, script, sim_json[, ...]) → int | None

Open a new AEDT window running script on job_dir; returns its pid (found by its command line).

pick_session(sessions[, pid]) → AedtSession | None

The session to attach to: pid (or QCC_AEDT_PID) if given, else the newest graphical session with a

progress_interval([progress]) → float | None

Seconds between progress lines (progress, else QCC_AEDT_PROGRESS, else 30); 0 / negative → None.

resolve_mode([aedt, graphical]) → str

aedt → one of AEDT_MODES; None → graphical=True means "gui", else QCC_AEDT_MODE, else

Module Contents

class quantcore_circuits.sim_tools.aedt_session.AedtSession
describe() → str
cmdline: list[str] = []
created: float | None = None
exe: pathlib.Path | None
property graphical: bool
pid: int
property plugin_dir: pathlib.Path | None
property port: int | None

The gRPC port: -grpcsrv [host:]port on the command line, else a listening port in 50051–50100.

ports: list[int] = []
property version: int | None
quantcore_circuits.sim_tools.aedt_session.find_sessions(min_version: int = MIN_VERSION) → list[AedtSession]

AEDT processes of version ≥ min_version (batch ones too; see AedtSession.graphical), newest first.

quantcore_circuits.sim_tools.aedt_session.launch_gui(executable: pathlib.Path, job_dir: pathlib.Path, script: str, sim_json: str, wait: float = 60.0, log: pathlib.Path | None = None) → int | None

Open a new AEDT window running script on job_dir; returns its pid (found by its command line).

quantcore_circuits.sim_tools.aedt_session.pick_session(sessions: list[AedtSession], pid: int | None = None) → AedtSession | None

The session to attach to: pid (or QCC_AEDT_PID) if given, else the newest graphical session with a gRPC port. Batch (-ng) processes are never picked: they belong to someone’s running job.

quantcore_circuits.sim_tools.aedt_session.progress_interval(progress: float | None = None) → float | None

Seconds between progress lines (progress, else QCC_AEDT_PROGRESS, else 30); 0 / negative → None.

quantcore_circuits.sim_tools.aedt_session.resolve_mode(aedt: str | None = None, graphical: bool = False) → str

aedt → one of AEDT_MODES; None → graphical=True means "gui", else QCC_AEDT_MODE, else "batch".

quantcore_circuits.sim_tools.aedt_session.AEDT_MODES = ('batch', 'gui', 'attach')