-
Notifications
You must be signed in to change notification settings - Fork 41
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
feat: use 'foreground' delete policy to cancel k8s job #290
Conversation
computer-driver/src/main/java/org/apache/hugegraph/computer/driver/JobStatus.java
Outdated
Show resolved
Hide resolved
maybe we need to implement |
Done, and I have found the issue that blocked the minikube test. please review the latest changed files. |
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## master #290 +/- ##
============================================
+ Coverage 85.03% 85.07% +0.03%
- Complexity 3246 3278 +32
============================================
Files 345 349 +4
Lines 12298 12411 +113
Branches 1102 1113 +11
============================================
+ Hits 10458 10559 +101
- Misses 1315 1320 +5
- Partials 525 532 +7 ☔ View full report in Codecov by Sentry. |
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.
thanks and could give more context about the issue/bug?
computer-driver/src/main/java/org/apache/hugegraph/computer/driver/DefaultJobState.java
Outdated
Show resolved
Hide resolved
computer-driver/src/main/java/org/apache/hugegraph/computer/driver/JobStatus.java
Outdated
Show resolved
Hide resolved
computer-test/src/main/java/org/apache/hugegraph/computer/k8s/MiniKubeTest.java
Outdated
Show resolved
Hide resolved
it may be this issue: #287 (comment) |
I still can't find the root cause. Let's keep this PR open for another two or three days. If it's still mysterious to me, we can append it to PR #287. |
@coderzc @javeme @imbajin I finally find the actual reason.
private boolean finalizer(HugeGraphComputerJob computerJob) {
if (computerJob.addFinalizer(FINALIZER_NAME)) {
---> // this is partial reason, can u use patch CR instead?
this.replaceCR(computerJob);
return true;
}
ComputerJobStatus status = computerJob.getStatus();
if (computerJob.isMarkedForDeletion()) {
if (!JobStatus.finished(status.getJobStatus())) {
status.setJobStatus(JobStatus.CANCELLED.name());
this.updateStatus(computerJob);
} else {
if (computerJob.removeFinalizer(FINALIZER_NAME)) {
this.replaceCR(computerJob);
}
}
return true;
} else {
if (JobStatus.finished(status.getJobStatus())) {
if (this.autoDestroyPod) {
this.deleteCR(computerJob);
}
return true;
}
}
return false;
}
ComputerJobComponent observed = this.observeComponent(computerJob);
----> //calculated status remains INITIALIZING forever, so won't deploy it again.
if (!this.updateStatus(observed) && request.retryTimes() == 0) {
LOG.debug("Wait status to be stable before taking further actions");
return OperatorResult.NO_REQUEUE;
}
if (Objects.equals(computerJob.getStatus().getJobStatus(),
JobStatus.RUNNING.name())) {
String crName = computerJob.getMetadata().getName();
LOG.info("ComputerJob {} already running, no action", crName);
return OperatorResult.NO_REQUEUE;
}
ComputerJobDeployer deployer = new ComputerJobDeployer(this.kubeClient,
this.config);
deployer.deploy(observed);
return OperatorResult.NO_REQUEUE;
solutionMy solution is to adjust the delete policy back to foreground. Everyone is happy now. |
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.
Thank you for your detailed analysis~
computer-driver/src/main/java/org/apache/hugegraph/computer/driver/DefaultJobState.java
Outdated
Show resolved
Hide resolved
computer-k8s/src/main/java/org/apache/hugegraph/computer/k8s/driver/KubernetesDriver.java
Outdated
Show resolved
Hide resolved
retry Line 316 in 0c447be
BTW, the u could import the hugegraph-style.xml to avoid most of the align/import problems |
Got it.
|
computer-driver/src/main/java/org/apache/hugegraph/computer/driver/DefaultJobState.java
Outdated
Show resolved
Hide resolved
@qwtsc Please correct the title of PR. |
foreground
delete policy rather than default background
option to pass the test case of cancel job
done |
foreground
delete policy rather than default background
option to pass the test case of cancel job
Purpose of the PR
Main Changes
Verifying these changes
Does this PR potentially affect the following parts?
Documentation Status
Doc - TODO
Doc - Done
Doc - No Need