-
Notifications
You must be signed in to change notification settings - Fork 76
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WFLY-19706 More gracefully handle the job execution status during a server crash. #590
Draft
liweinan
wants to merge
14
commits into
jberet:main
Choose a base branch
from
liweinan:WFLY-19706
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+226
−45
Draft
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
74b3dfa
WFLY-19706
liweinan 6ad479c
cleaup
liweinan 9198070
add `ForceStopJobOperatorImpl`
liweinan c3c101c
refactor
liweinan 68e6422
refactor the test
liweinan 205efa8
add the `getTimeoutJobExecutions()` method in `JobRepository`
liweinan c6aa1f5
save progress
liweinan f724768
update getTimeoutJobExecutions() in JdbcRepository
liweinan cbdaeda
update
liweinan 948a838
update
liweinan 0491fe8
update
liweinan 424945c
update SQL
liweinan bf807b8
update query
liweinan ada3be2
update
liweinan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
jberet-core/src/main/java/org/jberet/operations/ForceStopJobOperatorImpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package org.jberet.operations; | ||
|
||
import jakarta.batch.runtime.BatchStatus; | ||
import org.jberet.runtime.JobExecutionImpl; | ||
|
||
public class ForceStopJobOperatorImpl extends DefaultJobOperatorImpl { | ||
public void forceStop(final long executionId) { | ||
final JobExecutionImpl jobExecution = getJobExecutionImpl(executionId); | ||
jobExecution.setBatchStatus(BatchStatus.STOPPED); | ||
jobExecution.setLastUpdatedTime(System.currentTimeMillis()); | ||
getJobRepository().updateJobExecution(jobExecution, false, false); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The relative step executions and partition executions need to be updated here too. |
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
jberet-core/src/main/java/org/jberet/spi/ForceStopJobOperatorContextSelector.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package org.jberet.spi; | ||
|
||
import org.jberet.operations.ForceStopJobOperatorImpl; | ||
|
||
public class ForceStopJobOperatorContextSelector implements JobOperatorContextSelector { | ||
private final JobOperatorContext jobOperatorContext; | ||
|
||
/** | ||
* Creates a new default context selector | ||
*/ | ||
public ForceStopJobOperatorContextSelector() { | ||
jobOperatorContext = JobOperatorContext.create(new ForceStopJobOperatorImpl()); | ||
} | ||
|
||
@Override | ||
public JobOperatorContext getJobOperatorContext() { | ||
return jobOperatorContext; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we can set the
exitstatus
intoCRASHED
.And we need to update the
endtime
to the current time.We also need to update the other tables here:
partition_execution
step_execution
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This isn't thread safe. You'd really need all this to happen in something similar to a transaction which either all or none are updated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I should put them into a single tx like the implementation in the current
stop()
method inJdbcRepository
: