qcc_kplugin.jobs

Background qcc subprocesses for the GUI: run one command or a chain, show progress in the status bar, never block KLayout’s UI thread and never open a modal dialog from the timer (errors go to the status bar and the log).

run(steps, label, done) starts steps (a list of argument lists for qcc) one after the other; done(ok, output) is called from the polling timer when the last step ended or one failed. QuCat on a large netlist can take minutes: the UI stays usable meanwhile, and the status bar shows the elapsed time.

A job stops by itself: when a step fails (the rest are skipped, done(False, output)), or after timeout seconds (the process is killed, timed_out is set and done(False, output) gets a “stopped” line). progress(job), when given, is called on every poll while the job runs (live_text() is the output so far, also of the running step).

Attributes

Classes

Job

Functions

busy(label_prefix) → bool

kill_tree(proc) → None

Stop a qcc process and its children (qcc.exe is a launcher that starts python.exe).

run(steps, label, done[, cwd, timeout, progress]) → Job

Module Contents

class qcc_kplugin.jobs.Job(steps, label, done, cwd=None, timeout=None, progress=None)
cancel() → None

Stop the job: kill the qcc process (tree) of the running step, skip the rest, drop its log. done is called with (False, "cancelled") and job.cancelled set, so the caller can restore what it showed.

elapsed() → float
live_text() → str

The output so far: the finished steps and what the running step has written.

poll() → None
start() → Job
wait(timeout: float = 600.0) → bool

Block until finished (tests only; the GUI never calls this).

cancelled = False
cwd = None
done
finished = False
index = -1
label
log_path: pathlib.Path | None = None
ok = False
output = ''
proc: subprocess.Popen | None = None
progress = None
started
steps
timed_out = False
timeout = None
timer
qcc_kplugin.jobs.busy(label_prefix: str) → bool
qcc_kplugin.jobs.kill_tree(proc: subprocess.Popen) → None

Stop a qcc process and its children (qcc.exe is a launcher that starts python.exe).

qcc_kplugin.jobs.run(steps, label, done, cwd=None, timeout=None, progress=None) → Job
qcc_kplugin.jobs.RUNNING: list[Job] = []