Advanced Octave A59 — Job progress and cancellation
Advanced GNU Octave with GX-TXT · Module 10
In a block processing it is useful to communicate the phase and how many blocks have been completed. Early arrest also requires to declare whether the result is partial.
Objectives and prerequisites
We use the Runner and the Script Bridge introduced in the first module. The test uses GX-TXT dev112-P011-bis and GNU Octave 9.4.0. Import avanzamento.m, register it and run it in the Runner.
Events and Controlled Stop
PROGRESS_API_v1/publish receives structured events with status, mode, phase, message, current and total value. The script publishes start, running updates and finally completed. The current and total fields describe progress; reaching the total does not replace the explicit declaration of the final state.
To make a partial result visible, the stop_after variable is fixed at 7: the cycle goes out after the seventh block of ten and prints the reason. The execution ends normally and the final event declares a partial example completed; it does not claim that all ten blocks have been processed.
Effective cancellation
The stop of the example is decided by the program: it is not a proof of the Job cancellation button. A user request to a Job and a cooperative interruption are different mechanisms; the effects depend on the runner and contract of the operation. Do not assume that a request immediately terminates work or automatically produces usable results. An application must explicitly manage resources, status and partial results according to the available APIs.
Exercise
- How many blocks are processed in the test?
- Why doesn’t
completedmean that all ten blocks have been processed? - Does the script prove that a Job can be deleted instantly from the GUI?
Worked solution
- Seven.
- The execution normally ends after an arrest provided by the program and declares that the result is partial.
- No: a deletion from the GUI has not been performed or verified.
Other steps of this project
- Advanced Octave A75 — Dynamical systems in phase space
- Advanced Octave A81 — Geography of the waves and a 3D surface
- Advanced Octave A82 — Age, sex and demographic inequalities
- Advanced Octave A83 — All-cause mortality, certified COVID deaths and surveillance
- Advanced Octave A84 — A reproducible public account
- Advanced Octave A73 — Optimization landscapes and 3D trajectories