Results 1 to 3 of 3

Thread: Monitor the progress of a batch job

  1. #1
    Join Date
    Oct 2009
    Posts
    16

    Default Monitor the progress of a batch job

    I have a requirement to track the progress of a currently running job.

    Question 1: How can I at RUNTIME determine the steps in a job?

    I know that I can use the JobExplorer, JobOperator and JobRepository to get various job related meta data, but this is not sufficient to properly track progress. I need to determine the steps that are still coming so that I can report, at the very least, something like. Running step 2 of 5.

    Question 2: Do you know of a better way to track the progress of a step?

    I also want to track the progress within a step. Something like 250 of 3000 and I am thinking of using a @BeforeStep to count the number of items that will be processed and then storing that in the ExecutionContext of the step. The number already processed I can get from the writeCount on the StepExecution.The view could query the running executions and get the step progress like that.

  2. #2
    Join Date
    Feb 2008
    Posts
    488

    Default

    1: Maybe make use of AbstractJob.getStepNames()? I'm not sure what kind of program you want to use to do the monitoring, but it seems like you should be able to extract a list of step names and put it somewhere accessible.

    2: Counting the number of items seems like a waste of cycles, but your idea of querying and storing would certainly work.

  3. #3
    Join Date
    Oct 2009
    Posts
    16

    Default

    Thanks a lot. This is exactly what I was looking for. I don't know how I missed that. I did not even think checking the job. So now I am going to load the SimpleJob object using the normal spring context then ask for the steps.

    The application is a web based app that should provide a way for a operations user to monitor and track batches. They want to have a feeling of how far the batch is from finishing and knowing that the batch is currently on step 2 of 5 and that it has processed 50% of the items for step two will be sufficient.

    It should not have an impact on the job execution because it will be mainly user driven. The count will be done once when the step starts and the step count will be done when the user opens the monitoring view.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •