Results 1 to 7 of 7

Thread: Can't restart restartable job that was killed?

  1. #1
    Join Date
    Jul 2005
    Location
    Austin, TX
    Posts
    137

    Default Can't restart restartable job that was killed?

    Hi all,

    I have a job that is set as restartable. I execute the following command line,
    Code:
    java -jar myjar.jar app-config.xml loadBarData tradingDate=2011-04-14
    with a single parameter, and it happily goes off and starts churning. (My jar manifest's Main-Class is org.springframework.batch.core.launch.support.Comm andLineJobRunner.) Then, I intentionally kill it via ctrl-c, hoping to test restartability.

    Next, I issue the same command as before except with the -restart option at the end, and I get the following error:
    Code:
    ERROR 2011-04-28 23:27:09,735 [main] - Job Terminated in error: No failed or stopped execution found for job=loadBarData
    org.springframework.batch.core.launch.JobExecutionNotFailedException: No failed or stopped execution found for job=loadBarData
            at org.springframework.batch.core.launch.support.CommandLineJobRunner.start(CommandLineJobRunner.java:327)
            at org.springframework.batch.core.launch.support.CommandLineJobRunner.main(CommandLineJobRunner.java:574)
    ERROR 2011-04-28 23:27:09,735 [main] - Job Terminated in error: No failed or stopped execution found for job=loadBarData
    org.springframework.batch.core.launch.JobExecutionNotFailedException: No failed or stopped execution found for job=loadBarData
            at org.springframework.batch.core.launch.support.CommandLineJobRunner.start(CommandLineJobRunner.java:327)
            at org.springframework.batch.core.launch.support.CommandLineJobRunner.main(CommandLineJobRunner.java:574)
    ERROR 2011-04-28 23:27:09,735 [main] - Job Terminated in error: No failed or stopped execution found for job=loadBarData
    org.springframework.batch.core.launch.JobExecutionNotFailedException: No failed or stopped execution found for job=loadBarData
            at org.springframework.batch.core.launch.support.CommandLineJobRunner.start(CommandLineJobRunner.java:327)
            at org.springframework.batch.core.launch.support.CommandLineJobRunner.main(CommandLineJobRunner.java:574)
    Uh, the last job was killed by me and didn't complete! Why does Spring Batch think that the job completed? Alternatively, why can't I restart a job that is marked as restartable? Here's my <job>:
    Code:
    	<job id="loadBarData" job-repository="jobRepository" restartable="true"
    		xmlns="http://www.springframework.org/schema/batch">
    		<step id="processInstrumentData">
    			<tasklet transaction-manager="marketTransactionManager">
    				<chunk reader="instrumentReader" processor="instrumentProcessor"
    					writer="incomingBarWriter" commit-interval="1">
    				</chunk>
    			</tasklet>
    		</step>
    		<listeners>
    			<listener ref="mailingJobExecutionListener" />
    		</listeners>
    	</job>
    It's evident to me that chunks are being committed ok, but I'm killing it right in the middle of a chunk.

    Thanks,
    Matthew

  2. #2
    Join Date
    Jul 2005
    Location
    Austin, TX
    Posts
    137

    Default

    [sound of crickets chirping]
    ...anyone? Bueller? Anyone?

  3. #3
    Join Date
    Apr 2011
    Posts
    4

    Default

    Do you use spring repository? If yes, you need to update the Job instance status as you killed the job, repository is not updated with proper status.

  4. #4
    Join Date
    Jul 2005
    Location
    Austin, TX
    Posts
    137

    Default

    Not quite sure what you mean by "spring repository", but I do have a JobRepository that is persistent across Spring Batch invocations (SQL Server).

    I'm surprised that Spring Batch doesn't put itself into a state that can detect whether or not a job was killed. Short of that, I suppose Spring Batch might be able to figure out if a job was killed.

    Dave, any ideas here?

    -matthew

  5. #5
    Join Date
    Apr 2011
    Posts
    4

    Default

    Yes I am talking about JobRepository! With the current design, the framework is not able to detect if the job is running or being by killed by OS. So unless you manually update the status for killed job instance in repository, you will not be able to restart it.

  6. #6
    Join Date
    Jul 2005
    Location
    Austin, TX
    Posts
    137

  7. #7
    Join Date
    Dec 2010
    Posts
    175

    Default

    Yes. Such functionality should be added to the framework so that manual update of status is not needed after abnormal termination of the job.

    On a sidenote, why do I need a separate registration to logon to spring jira?

Posting Permissions

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