AIMMS runs one procedure at a time. While a procedure runs, WebUI covers the page with its busy screen, so the user cannot start another procedure. WebUI itself, however, can request several procedures in quick succession: the Action Upon Leave procedure of the page the user leaves, and the Action Upon Load procedures of the page the user opens and of the tab pages on it.
Starting with WebUI 27.1, a procedure that is requested while another one is running waits, and starts automatically once the running procedure has finished. Waiting procedures run in the order in which they were requested.
Note
Before WebUI 27.1, such a procedure was not run, and WebUI showed the error data session:Running procedure 'ProcedureName' has resulted in an error: Procedure not run: some other procedure is already running (code=500). A typical case was a page with an Action Upon Load procedure that contains a Tabbed widget whose tab page also has an Action Upon Load procedure: one of the two procedures could fail.
When procedures have to wait
Because the busy screen blocks the page, procedures mostly have to wait in the following situations:
Navigating between pages. The Action Upon Leave and Action Upon Load procedures run one after another, see Order of page procedures. This also applies to the Action Upon Load procedures of tab pages, side panels and dialog pages.
A procedure that opens another page. When a procedure, for example the procedure behind a button, opens another page with
webui::OpenPageand then continues, the Action Upon Load procedure of the new page waits until that procedure has finished.
Procedures that AIMMS starts by itself do not wait, see Things to keep in mind.
Order of page procedures
When the user navigates to another page, the procedures run in this order:
The Action Upon Leave procedure of the main page that the user leaves.
The Action Upon Load procedure of the page that the user opens.
The Action Upon Load procedure of the shown tab page of each Tabbed widget on that page. A tab page whose own page contains a Tabbed widget is handled the same way, from the outside in.
Note
The Action Upon Leave procedure of a tab page does not run, neither when the user switches to another tab nor when the user leaves the page that hosts the Tabbed widget. Only the Action Upon Leave procedure of the main page runs. This is a known limitation, see Action Upon Leave.
The busy screen
While a procedure runs, WebUI shows its busy screen. When other procedures are waiting, the busy screen shows how many, for example “2 more actions waiting”, and offers two buttons:
Cancel interrupts the running procedure. The waiting procedures still run after it.
Cancel All removes the waiting procedures and interrupts the running one. The message “2 waiting actions were cancelled” is shown among the session messages.
Both buttons depend on AIMMS being able to interrupt the running procedure at that moment.
Things to keep in mind
A procedure may start later than it was requested. A waiting procedure starts only when the procedures before it have finished. There is no limit to the number of waiting procedures. Keep Action Upon Load and Action Upon Leave procedures short, as a long-running procedure delays everything that waits behind it.
Procedures run in the order of the requests. Make sure your procedures give the intended result when they run one after another in that order.
AIMMS may need a moment after a procedure. After a procedure has finished, AIMMS can still be busy for a short while, for example with the callbacks of data change monitors. WebUI then retries the next procedure for a few seconds. If AIMMS is still busy after that, the procedure fails with “some other procedure is already running”.
A lost connection cancels waiting procedures. If the connection to AIMMS is lost while procedures are waiting, they are cancelled. They do not run after the connection has been restored.
Procedures that AIMMS starts by itself do not wait. A procedure that AIMMS starts by itself, for example a scheduled or delegated run, does not wait for procedures started from WebUI. If it starts at the same moment as a procedure from WebUI, that procedure can still fail with “some other procedure is already running”.