0
votes

A Spring Cloud Composed Batch Task Job(jobid=1) is executed and stopped without Completion. If we try to run the task again from dataflow shell, the JobExecutionAlreadyRunningException is throwing. Even though new job id 2 is created for next task execution. Is that any solution available to run the next task even though previous task execution not completed/stopped

Tried in spring-cloud-dataflow-server-local-1.7.4 with MySql. The TASK_EXECUTION Table EXIT_CODE,EXIT_MESSAGE are not updated when there is failure or task stopped abnormally.

java.lang.IllegalStateException: Failed to execute CommandLineRunner at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:795) [spring-boot-2.0.6.RELEASE.jar!/:2.0.6.RELEASE] at org.springframework.boot.SpringApplication.callRunners(SpringApplication.java:776) [spring-boot-2.0.6.RELEASE.jar!/:2.0.6.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:315) [spring-boot-2.0.6.RELEASE.jar!/:2.0.6.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1242) [spring-boot-2.0.6.RELEASE.jar!/:2.0.6.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1230) [spring-boot-2.0.6.RELEASE.jar!/:2.0.6.RELEASE] at org.springframework.cloud.task.app.composedtaskrunner.ComposedtaskrunnerTaskApplication.main(ComposedtaskrunnerTaskApplication.java:29) [classes!/:2.0.2.RELEASE] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_144] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_144] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_144] at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_144] at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48) [composedtaskrunner-task-2.0.2.RELEASE.jar:2.0.2.RELEASE] at org.springframework.boot.loader.Launcher.launch(Launcher.java:87) [composedtaskrunner-task-2.0.2.RELEASE.jar:2.0.2.RELEASE] at org.springframework.boot.loader.Launcher.launch(Launcher.java:50) [composedtaskrunner-task-2.0.2.RELEASE.jar:2.0.2.RELEASE] at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:51) [composedtaskrunner-task-2.0.2.RELEASE.jar:2.0.2.RELEASE] Caused by: org.springframework.batch.core.repository.JobExecutionAlreadyRunningException: A job execution for this job is already running: JobExecution: id=1, version=1, startTime=2019-08-22 07:35:10.0, endTime=null, lastUpdated=2019-08-22 07:35:10.0, status=STARTED, exitStatus=exitCode=UNKNOWN;exitDescription=, job=[JobInstance: id=1, version=0, Job=[customBatchTask1]], jobParameters=[{-spring.cloud.task.executionid=1}] at org.springframework.batch.core.launch.support.SimpleJobLauncher.run(SimpleJobLauncher.java:110) ~[spring-batch-core-4.0.1.RELEASE.jar!/:4.0.1.RELEASE] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_144] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_144] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_144] at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_144] at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:343) ~[spring-aop-5.0.10.RELEASE.jar!/:5.0.10.RELEASE] at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:197) ~[spring-aop-5.0.10.RELEASE.jar!/:5.0.10.RELEASE] at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163) ~[spring-aop-5.0.10.RELEASE.jar!/:5.0.10.RELEASE] at org.springframework.batch.core.configuration.annotation.SimpleBatchConfiguration$PassthruAdvice.invoke(SimpleBatchConfiguration.java:127) ~[spring-batch-core-4.0.1.RELEASE.jar!/:4.0.1.RELEASE] at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:185) ~[spring-aop-5.0.10.RELEASE.jar!/:5.0.10.RELEASE] at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:212) ~[spring-aop-5.0.10.RELEASE.jar!/:5.0.10.RELEASE] at com.sun.proxy.$Proxy85.run(Unknown Source) ~[na:na] at org.springframework.boot.autoconfigure.batch.JobLauncherCommandLineRunner.execute(JobLauncherCommandLineRunner.java:163) ~[spring-boot-autoconfigure-2.0.6.RELEASE.jar!/:2.0.6.RELEASE] at org.springframework.boot.autoconfigure.batch.JobLauncherCommandLineRunner.executeLocalJobs(JobLauncherCommandLineRunner.java:179) ~[spring-boot-autoconfigure-2.0.6.RELEASE.jar!/:2.0.6.RELEASE] at org.springframework.boot.autoconfigure.batch.JobLauncherCommandLineRunner.launchJobFromProperties(JobLauncherCommandLineRunner.java:134) ~[spring-boot-autoconfigure-2.0.6.RELEASE.jar!/:2.0.6.RELEASE] at org.springframework.boot.autoconfigure.batch.JobLauncherCommandLineRunner.run(JobLauncherCommandLineRunner.java:128) ~[spring-boot-autoconfigure-2.0.6.RELEASE.jar!/:2.0.6.RELEASE] at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:792) [spring-boot-2.0.6.RELEASE.jar!/:2.0.6.RELEASE] ... 13 common frames omitted

1

1 Answers

2
votes

What are the arguments getting passed to the job???

Make sure you always pass a timestamp argument even if you do not use it.

The reason is because the job always expects unique set of arguments every time you run it. Seems your argument are same on second run and throwing this exception.

Once you have pass a timestamp it will always have unique value and the job will process.

Hope this helps. thanks.