Is there a afterAll-like listener function for batch jobs?
4 views (last 30 days)
Show older comments
Andre Zeug on 13 May 2020
Commented: Andre Zeug on 15 May 2020
I want to run processes in background using batch, such as for figure and video generation and file saving, and want to execute a control function right after the job is finished, to check whether the job was successful or not. For parfeval one can use afterEach and afterAll. Is there something similar for batch? Sure I don't want to stop my main function and wait for the job to be finished.
Jason Ross on 13 May 2020
There are a few ways to approach this.
You could periodically check the job state and then do something. The job will know if it's finished or failed and you could act accordingly. See the properties of the job for more information.
If you are using the MathWorks job scheduler you can set up callbacks that run when the job finishes. Those are described on the job properties page and there's an example here.
More Answers (0)
Find more on Job and Task Creation in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!