Announcement Announcement Module
Collapse
No announcement yet.
Can't restart restartable job that was killed? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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
    [sound of crickets chirping]
    ...anyone? Bueller? Anyone?

    Comment


    • #3
      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.

      Comment


      • #4
        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

        Comment


        • #5
          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.

          Comment


          • #6
            Posted enhancement request.
            https://jira.springsource.org/browse/BATCH-1740

            Comment


            • #7
              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?

              Comment

              Working...
              X