Re: Job tracking - FWIW, in my other project we created a table like this:
CREATE TABLE `batch_job_info` (
`job_instance_id` bigint(20) NOT NULL,
`number_processed` bigint(20) DEFAULT NULL,
`total` bigint(20) DEFAULT NULL,
`output_location` varchar(300) DEFAULT NULL,
`creating_user_id` int(11) DEFAULT NULL,
KEY `job_instance_fk` (`job_instance_id`),
KEY `creating_user_id_fk` (`creating_user_id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
The job_instance_id joins back to the Spring batch tables to get the status, but this allowed us to store other information about the job, (this is for NLP processing, so how reports rows processed, and how many currently have processed - similar to your example). This table is updated as the job processes, so we can watch it as it progresses through reports.
We can also join it to the user table and see who created it. Obviously, our needs are a little bit different, but it might be a model. Alex may have some other ideas that he’s implemented for this kinds of thing.
This query (we made into a view) joins the table with with spring batch tables to see the status, who created the job, how many reports the process has completed, etc.
SELECT bji.job_instance_id AS job_id,
bji.job_name AS job_name,
bje.create_time AS date_created,
bje.start_time AS date_started,
bje.end_time AS date_completed,
bje.status AS status,
bje.exit_code AS exit_code,
bje.exit_message AS exit_message,
bj_info.number_processed AS number_of_docs_processed,
bj_info.total AS total_docs,
bj_info.output_location AS output_location,
bj_info.creating_user_id AS creating_user_id,
u.username AS creating_username
FROM (((batch_job_instance bji
left join batch_job_execution bje
ON(( bji.job_instance_id = bje.job_instance_id )))
left join batch_job_info bj_info
ON(( bji.job_instance_id = bj_info.job_instance_id )))
left join users u
ON(( bj_info.creating_user_id = u.pk_id )))