You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@submarine.apache.org by zt...@apache.org on 2020/05/25 09:18:57 UTC
[submarine] branch master updated: SUBMARINE-513. Remove "\n" in
job logs
This is an automated email from the ASF dual-hosted git repository.
ztang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/submarine.git
The following commit(s) were added to refs/heads/master by this push:
new 69f3a0f SUBMARINE-513. Remove "\n" in job logs
69f3a0f is described below
commit 69f3a0fd29b19415281f3aee7e6b3010d0b058d3
Author: JohnTing <jo...@gmail.com>
AuthorDate: Mon May 25 00:50:06 2020 +0800
SUBMARINE-513. Remove "\n" in job logs
### What is this PR for?
When logging job output, the content contains "\n", didn't print correctly.
curl -X GET http://127.0.0.1:8080/api/v1/jobs/logs/job_1590165277436_0001
### What type of PR is it?
Improvement
### Todos
* [X ] - Task
### What is the Jira issue?
https://issues.apache.org/jira/projects/SUBMARINE/issues/SUBMARINE-513
### How should this be tested?
* First time? Setup Travis CI as described on https://submarine.apache.org/contribution/contributions.html#continuous-integration
* Strongly recommended: add automated unit tests for any new or changed behavior
* Outline any manual steps to test the PR here.
### Screenshots (if appropriate)
![image](https://user-images.githubusercontent.com/19265751/82760210-b0c60480-9e24-11ea-88e6-d7b33cee1fd4.png)
### Questions:
* Does the licenses files need update? Yes/No
* Is there breaking changes for older versions? Yes/No
* Does this needs documentation? Yes/No
Author: JohnTing <jo...@gmail.com>
Closes #297 from JohnTing/SUBMARINE-513 and squashes the following commits:
a411f37 [JohnTing] done
7ba4d8d [JohnTing] make JobLog MultiLine
---
.../apache/submarine/server/api/job/JobLog.java | 31 ++++++++++++++++------
1 file changed, 23 insertions(+), 8 deletions(-)
diff --git a/submarine-server/server-api/src/main/java/org/apache/submarine/server/api/job/JobLog.java b/submarine-server/server-api/src/main/java/org/apache/submarine/server/api/job/JobLog.java
index 66784b0..b0c033f 100644
--- a/submarine-server/server-api/src/main/java/org/apache/submarine/server/api/job/JobLog.java
+++ b/submarine-server/server-api/src/main/java/org/apache/submarine/server/api/job/JobLog.java
@@ -20,23 +20,31 @@
package org.apache.submarine.server.api.job;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.List;
public class JobLog {
private String jobId;
- private List<podLog> logContent;
+ private List<PodLog> logContent;
- class podLog {
+ class PodLog {
+
String podName;
- String podLog;
- podLog(String podName, String podLog) {
- this.podName = podName;
- this.podLog = podLog;
+ List<String> podLog = new ArrayList<String>();
+
+ PodLog(String name, String log) {
+ this.podName = name;
+ this.podLog = new ArrayList<String>();
+ addLog(log);
+ }
+ void addLog(String log) {
+ if ( log != null)
+ this.podLog.addAll(Arrays.asList(log.split("\n")));
}
}
public JobLog() {
- logContent = new ArrayList<podLog>();
+ logContent = new ArrayList<PodLog>();
}
public void setJobId(String jobId) {
@@ -48,7 +56,14 @@ public class JobLog {
}
public void addPodLog(String name, String log) {
- logContent.add(new podLog(name, log));
+ for (PodLog podlog : logContent) {
+ if (podlog.podName.equals(name))
+ {
+ podlog.addLog(log);
+ return;
+ }
+ }
+ logContent.add(new PodLog(name, log));
}
public void clearPodLog() {
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@submarine.apache.org
For additional commands, e-mail: dev-help@submarine.apache.org