spring-cloud / spring-cloud/spring-cloud-task

Relationship between Task and Job not recorded after a failure during beforeJob

Open
#672 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

type: enhancement
Dominant language
Java
Stars
446
Forks
310
Avg merge
18h 18m
Merged PRs (30d)
6

Description

In the table "task_task_batch", usually, there are recorded the relationships between the Task Execution Ids and the Job Execution Ids. We have a simple task that only contains a job, and the issue is that if there is an exception during the execution of the beforeJob statement, the relationship is not recorded.
Reviewing the tables that contains all the information of the job ("batch_job_execution", "batch_job_execution_context", "batch_job_execution_params", "batch_job_instance") and the task ("task_execution", "task_execution_metadata", "task_execution_params"), we can see that all the registers has been recorded.
We could think that since the error is "before the job", the relationship was not created because there would not be a job instance, but the records are there, so we do not know why the table "task_task_batch" is not filled.
This behavior makes, for example, that if we try to use the Spring Cloud Data Flow UI, and go to the "Jobs" menu, an Error is returned as it does not find the relationship between all the task executions and job executions.

For now, we have coded a work around in the afterJob statement (because it is executed even when there is a failure in the beforeJob) that check if the "task_tack_batch" table contains a record for the current taskExecutionId, and inserts it if it doesn't exist.

Release versions:
spring-cloud-task: 2.2.2.RELEASE
spring-boot: 2.1.2.RELEASE
spring-batch: 4.1.1.RELEASE
spring: 5.1.4.RELEASE

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing an exception during beforeJob and comparing writes to task_task_batch with the listed task and job tables. Done means the Task Execution–Job Execution relationship is recorded after the failure and the Spring Cloud Data Flow UI Jobs menu no longer errors.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring
Domain
backend, databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.