Stopping batch jobs
Stopping batch jobs is an essential function when processing large volumes of data.
It is useful to be able to stop a process to resolve any apparent issues and then restart the stopped process from the point where it stopped. Additionally, if a process crashes due to a system failure, you can restart the process from the crashed point.
- Stopping batch jobs manually
- When the batch processor receives a stop signal from an updateTask
transaction, it initiates a graceful stop. A graceful stop allows
unfinished processes to complete and writes all processed responses
to output files before shutting down the process. This type of stop
guarantees that all of the normal processing messages are written
to the output files and results files.
To manually initiate a graceful stop, you must use the updateTask transaction to change the status of the current batch job from Pending or In Progress to Stopping. After the batch process has shut down gracefully, the job status changes to Stopped.
- Stopping batch jobs gracefully due to errors
- When the batch processor encounters a serious system error, such as not being able to update a batch job status, it automatically updates the current batch job status to Stopped and gracefully shuts down the process.
- Stopping batch jobs unexpectedly
- When a batch job ends unexpectedly (crashes), there is no guarantee
that all processed messages will be written to the output file. This
is also known as a hard stop.
After a hard stop, the batch job status remains in an In Progress state, and the corresponding lock file remains in the $home folder.
When batch processing messages are not written to the output files after a hard stop, a later restart may cause some previously processed messages to be processed a second time. In this case, there may be duplicate requests in the restarted batch process. These duplicate requests will be handled by the InfoSphere® MDM services.
- Stopping batch job chains
You can manually stop any batch job when it is in the In Progress state. When dealing with a batch job chain, you can stop the entire chain by finding the first Pending or In Progress task and updating its status to Stopping. However, due to the heartbeat interval time, the status update might not be caught by the heartbeat thread before the batch job completes, meaning that the job can run until it is Complete. In this case, the batch processor instance changes the status of the Complete task to Stopped, and the processing will stop for the entire chain.
- Stopping a batch job or chain using command line
- You can stop a batch job or batch job chain immediately by running
the following command:
runbatch.sh -stop <processId>
Where <processId> is the process ID of the job or chain that you wish to stop.