Skip to content
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

Merged
merged 4 commits into from Nov 23, 2021
Merged

async watch the k8s job #148

merged 4 commits into from Nov 23, 2021

Conversation

coderzc
Copy link
Member

@coderzc coderzc commented Nov 17, 2021

No description provided.

@@ -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()) {
Copy link
Contributor

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,
Copy link
Contributor

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,
Copy link
Contributor

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);
Copy link
Contributor

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()?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems unnecessary

javeme
javeme previously approved these changes Nov 18, 2021
@codecov
Copy link

codecov bot commented Nov 18, 2021

Codecov Report

Merging #148 (6c4a615) into master (52a2faf) will decrease coverage by 0.53%.
The diff coverage is 100.00%.

Impacted file tree graph

@@             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     
Impacted Files Coverage Δ
...ugegraph/computer/k8s/driver/KubernetesDriver.java 86.94% <100.00%> (+1.38%) ⬆️
...ugegraph/computer/core/output/hdfs/HdfsOutput.java 0.00% <0.00%> (-79.63%) ⬇️
...ph/computer/core/output/hdfs/HdfsOutputMerger.java 0.00% <0.00%> (-75.76%) ⬇️
...uter/algorithm/path/rings/filter/SpreadFilter.java 79.68% <0.00%> (-1.57%) ⬇️
...h/computer/core/receiver/MessageRecvPartition.java 100.00% <0.00%> (ø)
.../algorithm/centrality/pagerank/PageRankOutput.java 100.00% <0.00%> (ø)
...ithm/centrality/degree/DegreeCentralityParams.java 100.00% <0.00%> (ø)
...m/community/trianglecount/TriangleCountOutput.java 100.00% <0.00%> (ø)
...m/baidu/hugegraph/computer/core/util/FileUtil.java 83.33% <0.00%> (ø)
...ithm/centrality/degree/DegreeCentralityOutput.java 100.00% <0.00%> (ø)
... and 6 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 52a2faf...6c4a615. Read the comment docs.

@imbajin
Copy link
Member

imbajin commented Nov 19, 2021

we need also update the version in pom.xml in k8s-api & driver, modify them then update the remote repository image

@@ -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
Copy link
Member

@imbajin imbajin Nov 19, 2021

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)

@@ -15,7 +15,7 @@
<dependency>
<groupId>com.baidu.hugegraph</groupId>
<artifactId>computer-k8s</artifactId>
<version>${project.version}</version>
<version>0.1.1</version>
Copy link
Member

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

* update version to 0.1.1
@javeme javeme merged commit af18dfc into master Nov 23, 2021
@javeme javeme deleted the async_k8s_wait branch November 23, 2021 12:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants