I have the composed task myFailedTask
with 2 steps and one of them is configured to fail all the time :
<mf1: sampleTask --fail=true --custom-argument=m || sampleTask>
On first run, the job runs with run.id
equals 1 and and mf1
is reported as failed.
Next time I run the CTR,the job is run with run.id
equals to 1 again and sampleTask
step is skipped:
2017-11-29 15:30:30.146 INFO 11604 --- [ taskExecutor-2] o.s.batch.core.job.SimpleStepHandler : Step already complete or not restartable, so no action to execute: StepExecution: id=97, version=3, name=myFailedTask-sampleTask_0, status=COMPLETED, exitStatus=COMPLETED, readCount=0, filterCount=0, writeCount=0 readSkipCount=0, writeSkipCount=0, processSkipCount=0, commitCount=1, rollbackCount=0, exitDescription=
I'm executing the CTR using the httpclient
transformer deployed with below properties file :
app.httpclient.body-expression='name='+new com.fasterxml.jackson.databind.ObjectMapper().readTree(payload).findValue('taskName').asText()+ \
'&arguments=\
--increment-instance-enabled=true \
--split-thread-core-pool-size=10 \
--interval-time-between-checks=5000 \
--composed-task-arguments=--message='+new String(T(java.util.Base64).getEncoder().encode(payload.getBytes()))
app.httpclient.http-method=POST
app.httpclient.url=http://localhost:9393/tasks/executions
app.httpclient.headers-expression={'Content-Type':'application/x-www-form-urlencoded'}
I also change the --composed-task-arguments
via different payload between CTR invocations - same effect.
So, my question is how could I force the CTR to run new job and not proceed the previously failed job from the failed step.
UPDATE
OK, digging into spring sources, the below code from JobLauncherCommandLineRunner::getNextJobParameters
explains the behavior:
if (isStoppedOrFailed(previousExecution) && job.isRestartable()) {
// Retry a failed or stopped execution
parameters = previousExecution.getJobParameters();
// Non-identifying additional parameters can be removed to a retry
removeNonIdentifying(additionals);
}
else if (incrementer != null) {
// New instance so increment the parameters if we can
parameters = incrementer.getNext(previousExecution.getJobParameters());
}
So I'm rephrasing the original question : "How can I pass the restartable
attribute to CTR ?