qcc_kplugin.simrun

A qcc sim auto run that outlives KLayout (plain Python, no pya: unit-tested outside KLayout).

Simulate starts the run detached (own process group, no console window, breaking away from a job object that would end it with KLayout), with its output in <design>.flow/sim_run.log. <design>.flow/sim_run.json is the run record: pid, start time, arguments, the log and the status file qcc writes, and the state. When the design is opened again (or KLayout restarts with it) flow.resume_runs() reads the record: a run that ended meanwhile is imported (its results are already in the design’s run state; qcc also saved them as build/<name>/<name>_<group>_results.json), a run still going is watched and imported when it ends.

Attributes

Classes

PidProc

The Popen look-alike of a run this KLayout did not start (poll / pid / terminate).

Functions

launch(cmd, cwd, env, log_path) → subprocess.Popen

Start cmd detached from this process: it keeps running when KLayout quits. Output goes to log_path.

outcome(rec) → str

running while the process lives, else done / failed / cancelled from what qcc wrote (its status

pid_alive(pid) → bool

read_record(flow_dir) → dict | None

record_path(flow_dir) → pathlib.Path

write_record(flow_dir, rec) → None

Module Contents

class qcc_kplugin.simrun.PidProc(rec: dict)

The Popen look-alike of a run this KLayout did not start (poll / pid / terminate).

poll()
terminate()
wait(timeout=None)
pid
rec
returncode = None
qcc_kplugin.simrun.launch(cmd, cwd, env, log_path) → subprocess.Popen

Start cmd detached from this process: it keeps running when KLayout quits. Output goes to log_path.

qcc_kplugin.simrun.outcome(rec: dict) → str

running while the process lives, else done / failed / cancelled from what qcc wrote (its status file, else the log’s “done in” line); a process that vanished without either is failed.

qcc_kplugin.simrun.pid_alive(pid: int) → bool
qcc_kplugin.simrun.read_record(flow_dir) → dict | None
qcc_kplugin.simrun.record_path(flow_dir) → pathlib.Path
qcc_kplugin.simrun.write_record(flow_dir, rec: dict) → None
qcc_kplugin.simrun.CREATE_BREAKAWAY_FROM_JOB = 16777216
qcc_kplugin.simrun.CREATE_NEW_PROCESS_GROUP = 512
qcc_kplugin.simrun.CREATE_NO_WINDOW = 134217728
qcc_kplugin.simrun.LOG = 'sim_run.log'
qcc_kplugin.simrun.RECORD = 'sim_run.json'
qcc_kplugin.simrun.STILL_ACTIVE = 259