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
async watch the k8s job #148
Conversation
@@ -426,6 +419,11 @@ public String log(String jobId, int containerId, long offset, long length, | |||
|
|||
@Override | |||
public void close() { | |||
for (String jobId : this.waits.keySet()) { |
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.
can iterate this.waits.values()
|
||
this.driver.cancelJob(jobId, params); | ||
this.driver.waitJob(jobId, params, jobObserver); | ||
CompletableFuture<Void> watchJob = this.driver.watchJob(jobId, params, |
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.
what's the behavior after cancel and re-watch?
@@ -287,13 +286,14 @@ public void cancelJob(String jobId, Map<String, String> params) { | |||
} | |||
|
|||
@Override | |||
public void waitJob(String jobId, Map<String, String> params, | |||
JobObserver observer) { | |||
public CompletableFuture<Void> watchJob(String jobId, |
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.
prefer keep waitJob() name or waitJobAsync
@@ -139,7 +123,7 @@ public void testJobSucceed() { | |||
Mockito.verify(jobObserver, Mockito.timeout(15000L).atLeast(1)) | |||
.onJobStateChanged(Mockito.eq(jobState2)); | |||
|
|||
future.getNow(null); | |||
future.cancel(true); |
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.
why not wait for success with future.get()?
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.
It seems unnecessary
Codecov Report
@@ Coverage Diff @@
## master #148 +/- ##
============================================
- Coverage 87.88% 87.35% -0.54%
+ Complexity 2916 2906 -10
============================================
Files 306 308 +2
Lines 10982 10975 -7
Branches 930 930
============================================
- Hits 9652 9587 -65
- Misses 880 944 +64
+ Partials 450 444 -6
Continue to review full report at Codecov.
|
we need also update the version in |
@@ -56,9 +57,11 @@ | |||
* job is waiting by another thread. | |||
* @param params reserved for other parameters in addition to jobId used | |||
* to wait job. | |||
* @return future for watch the job |
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.
in line 52
void cancelJob() --> boolean cancelJob is better? (so as the impl)
9fba71f
to
5578d88
Compare
computer-k8s-operator/pom.xml
Outdated
@@ -15,7 +15,7 @@ | |||
<dependency> | |||
<groupId>com.baidu.hugegraph</groupId> | |||
<artifactId>computer-k8s</artifactId> | |||
<version>${project.version}</version> | |||
<version>0.1.1</version> |
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.
keep original param & modify the parent version
5578d88
to
ae26f55
Compare
* update version to 0.1.1
ae26f55
to
6c4a615
Compare
No description provided.