Results 1 to 7 of 7

Thread: how to restart the Executing jobs

  1. #1
    Join Date
    Sep 2012
    Posts
    16

    Default how to restart the Executing jobs

    Hi all,
    I have a situation.
    When the Spring batch is running and if due to any reason the process crashes, the currently executing job is exiting in the STATE as EXECUTING and not able to restart that job again.

    Can any one please tell me how can i get through this.
    I have only one parameter in the job and this cannot be changed, the job with same job parameter has to be executed?

  2. #2
    Join Date
    Sep 2008
    Location
    Chicagoland, IL
    Posts
    338

    Default

    Two things:
    1. I'd be interested in seeing the stack trace that is causing the error. The framework should handle thrown exceptions (assuming it can) and mark the execution accordingly.
    2. To restart your job, you'll have to manually mark it as FAILED.
    Michael Minella
    Spring Batch Lead
    Author - Pro Spring Batch
    http://www.michaelminella.com
    Twitter: @MichaelMinella

  3. #3
    Join Date
    Sep 2012
    Posts
    16

    Default

    Hi mminella,
    Im afraid i can provide any stack trace?.... I suspect there could be any stack trace or error if process is crashed due the server going down...
    Basically the server im running has many other different processes which may cause the whole system crash due high CPU/IO usage by all the processes at the same.

    With respect to Point 2:
    How to manually set the Job to be failed.. jus setting the job in the Spring batch DB is sufficient or any thing else is required to be performed??

    Can u please provide in detail on how to set the job as FAILED?

    Thanks,
    Ravi Shanker .P

  4. #4
    Join Date
    Sep 2008
    Location
    Chicagoland, IL
    Posts
    338

    Default

    Updating the database is all you need to do. Be sure to update both the job and any step that my have been in the RUNNING state to FAILED.
    Michael Minella
    Spring Batch Lead
    Author - Pro Spring Batch
    http://www.michaelminella.com
    Twitter: @MichaelMinella

  5. #5
    Join Date
    Sep 2012
    Posts
    16

    Default

    Hi Micheal,

    As indicated, i tried changing the STATUS and EXIT_CODE of the Executing/Started jobs to FAILED state while the process has crashed.. but still Im getting JobInstance already exists error while restarting the Job.

    Can u please let me know other than the STATUS what else is required for me to update.

  6. #6
    Join Date
    Sep 2008
    Location
    Chicagoland, IL
    Posts
    338

    Default

    How are you launching the job?
    Michael Minella
    Spring Batch Lead
    Author - Pro Spring Batch
    http://www.michaelminella.com
    Twitter: @MichaelMinella

  7. #7
    Join Date
    Aug 2011
    Posts
    20

    Default

    You also need to set the END_TIME of the job execution.

Posting Permissions

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