Skip to content

Faster ui-smoke and workplane-retain: wait on the GUI, and two shutdown waits that never ended - #4782

Draft
grandixximo wants to merge 6 commits into
LinuxCNC:masterfrom
grandixximo:ui-smoke-speed
Draft

grandixximo wants to merge 6 commits into
LinuxCNC:masterfrom
grandixximo:ui-smoke-speed

Conversation

@grandixximo

Copy link
Copy Markdown
Contributor

Based on #4778: the first two commits are that PR's, so this stays a draft until it merges. The ui-smoke driver resets the estop and turns the machine on back to back, and without #4778 qtdragon and gmoccapy then keep showing the estop set in the confirm shots.

Follow-up to #4770, for the tests on Bertho's list that are mine: ui-smoke axis, touchy and gmoccapy, and workplane-retain.

Two commits fix waits outside the tests that every shutdown paid:

  • gladevcp ignored halcmd unload. The SIGTERM becomes a KeyboardInterrupt, and PyGObject swallows it when it lands in a GLib callback. A panel was still alive 5 s after an unload, 3 times in 3; it now exits within 0.2 s and releases its component.
  • linuxcnc's Cleanup waited its full 2 s for user components whose process is gone. gmoccapy never frees its component, and touchy and any GUI killed by a signal leave theirs. It now waits only for components that can still leave.

The ui-smoke driver no longer pauses 3 s for the GUI, half a second after each state and mode change, or 0.4 s after opening the program:

  • It waits for the GUI's HAL component to be ready and, for the X GUIs, for its main window to be viewable. gmoccapy reports ready early in its constructor and then sends startup commands of its own; a jog stop among them aborted a homing begun meanwhile, which cost 15 s per run.
  • An attempt a GUI undoes is retried as soon as the driver can tell: the machine left ON, homing was aborted, the mode left AUTO, or a newer command switched the mode back (qtdragon and gmoccapy switch to MANUAL once they see all-homed).
  • The program is opened after homing, once the GUIs have opened their own startup files.
  • The 2 s pause after homing stays for gmoccapy only: it offers AUTO only after it has processed all-homed, and shows nothing to wait on.
  • Before the confirm shot it waits for the LinuxCNC splash to close. The AXIS manual toolchanger note stays in the axis shot; it is up at that point in every run, loaded or not.

The confirm-shot settle check is unchanged. The committed reference images were taken by the old driver, later in the run, so axis's lacks the toolchanger note and the others differ in small ways; I will add a commit with new references from this PR's CI artifacts.

workplane-retain is split into retain/ and clear/, like abort/g64.

Times in seconds; loaded is 6 copies of each at -j 12 with 4 busy loops, all passing twice:

test master this PR master, loaded this PR, loaded
ui-smoke/axis 15.2 8.2 17.6 14.2
ui-smoke/touchy 14.0 8.1 16.3 12.1
ui-smoke/gmoccapy 18.9 13.2 38.0 21.3
ui-smoke/qtdragon 13.7 8.3
workplane-retain 19.3 10.1 each

Full suite 355/355 at -j 4 in 177 s. The slowest test left is mdi-while-queuebuster-waitflag, about 22 s here.

GStat emitted state-estop-reset only for ESTOP => ESTOP_RESET.  A client
that resets the estop and turns the machine on between two polls goes
from ESTOP straight to ON, and qtdragon and gmoccapy kept showing the
estop set on a machine that was on.
The status handlers set the estop and machine on buttons, whose toggled
handlers then sent that state again.  Once GStat reports the estop reset
that comes with an ESTOP => ON change, gmoccapy sent an ESTOP_RESET to a
machine already on, which aborts its motion.  Block the toggled handler
while showing the state; on machine on, also update the widgets as the
toggled handler did.
halcmd unload sends SIGTERM, which hal turns into KeyboardInterrupt and
gladevcp expects to come out of Gtk.main().  When it lands in a GLib
callback, such as the status polls, PyGObject prints it and the main
loop goes on, so the panel never left: touchy's touchy_test panel was
still alive 5 seconds after an unload, 3 times in 3.  Without a panel
handler of its own, gladevcp now quits the main loop on SIGTERM, exits
within 0.2 seconds and releases its component.
Cleanup waits for the components to leave before it stops realtime.  A
user component whose process exited without hal_exit() can never leave,
so the wait ran its full 2 seconds.  gmoccapy leaves its component on
every exit, and touchy and any GUI killed by a signal do the same.  Wait
only for realtime components and for user components whose process is
still alive.
The driver paused 3 seconds for the GUI to settle, half a second after
every state and mode change to see whether a GUI undid it, 2 seconds
after homing and 0.4 seconds after opening the program.

- Wait for the GUI's HAL component to be ready (--gui-comp) and, for
  the X GUIs, for its main window to be viewable (--gui-window).
  gmoccapy reports ready early in its constructor and then sends its own
  startup commands; a jog stop among them aborts a homing begun meanwhile.
- No stability pause: an attempt that a GUI undoes is retried, and gives
  up as soon as the machine leaves ON, homing is aborted or the mode
  leaves AUTO, instead of sitting out its timeout.  If the machine goes
  off after homing, home again from unhomed; a run that a GUI aborts by
  leaving AUTO is run again.  A mode request that a newer command undid
  (qtdragon switches to MANUAL once it sees all-homed) is repeated at
  once, not after 3 seconds.
- Open the program after homing, when the GUIs have opened their own
  startup files (an earlier open collides with axis's).
- The 2 second pause after homing stays for gmoccapy only
  (--post-home-settle): it offers AUTO only once it has processed
  all-homed and shows nothing to wait on.  The pause also lets it see
  the program while the interp is idle.
- Before the confirm shot, wait for the LinuxCNC splash to close itself,
  so it does not cover touchy.  The note of the AXIS manual toolchanger
  stays in the axis shot: it is up at that point in every run, loaded
  or not, and the shot shows it if it ever goes.
- Poll for linuxcnc's exit every 0.1 second, not every second.

Unloaded at -j 4: axis 15.2 => 8.2, touchy 14.0 => 8.1, gmoccapy
18.9 => 13.2, qtdragon 13.7 => 8.3 seconds, the same in 15 runs out of
15.  With 6 copies of each of axis, touchy and gmoccapy at -j 12 and 4
busy loops: axis 17.6 => 14.2, touchy 16.3 => 12.1, gmoccapy 38.0 =>
21.3, 36 of 36 passing.
The test started linuxcnc twice, with RETAIN_WORK_PLANE and without,
about 20 seconds in all.  Each setting is now a test of its own, like
abort/g64: retain/ and clear/ hold the [RS274NGC] section and include
the shared settings in workplane.inc.  The checks are the same.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant