Blog

Asynchronous Task/Report execution

  • 1 July 2019
  • 1 reply
  • 531 views
Asynchronous Task/Report execution
Userlevel 5
Badge +5
Most of us probably have been in the situation where you wrote a time-consuming SQL stored procedure for a task or designed a report that takes a long time to create, knowing that your users will have to wait until everything is done before they can continue working in the GUI. The same goes for tasks or reports that are executed on multiple rows at once.

Waiting for an hourglass to stop spinning is very boring so users will lose their patience and look for alternative ways to finish their work. You can put a progress dialog on it showing the users how long they will need to wait. But what if a task will take minutes or even hours? Maybe we would start multiple GUIs at once to split the work that needs to be done and visit the blocked GUI occasionally to watch the progress. We could lose some valuable time here not knowing exactly when the time-consuming action will finish exactly.

How cool would it be when the user could simply continue their work after starting their action, and still have information about the progress of the running work? To do this, we have added a way to run tasks and reports in the background and to monitor and maintain those actions.


User interface

You can get access to the new ‘Running tasks’ monitor in the upper right corner of the user interface.


A window opens presenting all running and finished background tasks.


The window can be placed anywhere on the screen, even on a secondary monitor, and is fully resizable and responsive.

Task representation

The entries in the monitor will show the user which related task it represents, showing the task or report name and the values of the configured display parameter.

A running task will:
- Show a progress indicator - percentage and optional supporting message
- Show options to cancel/delete the task.


A completed task will:
- Show a completed progress indicator
- Offer the result
- Show an option to delete the task.


A failed task will:
- Show a progress indicator including an error message
- Offer the error details
- Show an option to delete the task.


An extra ‘scheduler’ entry will be shown when the user starts a chain of tasks based on a selection of items. This entry represents the overall progress of all sub tasks combined. When all sub tasks are finished, it contains the overall result, for example a zip file of multiple executed reports. When running, the progress of the currently running subtask is also shown.


Start/stop notification

The user is informed when a task has been started and finished tasks via Windows notifications in the bottom right corner of the Windows taskbar.



Configuration

For tasks and reports modelled in the Software Factory, the field Await Result can be used to configure the behavior on execution. Please consult the documentation for more information:
You should know we only support specific task/report types running in the background. We do not support type Windows command since it opens an external program directly executing the job. In case of type Print preview, the report is created by the preview dialog with its own progress reporting. Custom tasks of type GUI code can run in the background when configured correctly. Please consult with Product Innovation if you want to convert your custom task to a background running one.

Under the hood

A background task executed on a single record will run on its own and can be started multiple times. These tasks will run in parallel.

When executing a task on multiple rows at once, the task will run one by one for each row. Previous execution may influence the upcoming executions and we want to prevent the user from blowing up their PC or the database.

Usage suggestion

When using an asynchronous task in a process flow, the process execution will not wait for the background task to finish. It assumes the task was executed successfully and continues with the next step. Our advice: only use background tasks as an end node of the process flow.

An asynchronous task will not update the related document after execution. The document could even be closed already for example.

Future

We are currently working on support for this feature in the Web user interface. With this solution the request to start the long running task will be back to the client very fast and the monitor will open an active connection with the web-server to show actual progress and post completion notification.

The plan is to use this task monitor for other types user action. E.g.:
  • File uploads
  • Import / Exports
  • Etc.
We also need to implement the Optional option for the Await Result field. A task then starts running in the foreground but the user has the option to move it to the background.

1 reply

Is there an option as well to make this a fully asynchronous task on the database? in a way that if you would loose your connection to the wifi, the task will continue to run? 

thanks in advance 

Reply