Skip to content

Commit

Permalink
Merge pull request #49 from FederatedAI/develop
Browse files Browse the repository at this point in the history
update version 1.4.1
  • Loading branch information
dylan-fan authored Jun 15, 2020
2 parents f259cef + f8ef200 commit d2552c0
Show file tree
Hide file tree
Showing 23 changed files with 398 additions and 51 deletions.
7 changes: 7 additions & 0 deletions RELEASE.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
# Release 1.4.1

#### Major Features and Improvements
- support PSI display in evaluation component
- Support confusion matrix display
- update logs interface
- Firefox basic compatibility
# Release 1.4.0

#### Major Features and Improvements
Expand Down
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>fateboard</groupId>
<artifactId>fateboard</artifactId>
<version>1.4.0</version>
<version>1.4.1</version>

<parent>
<groupId>org.springframework.boot</groupId>
Expand Down Expand Up @@ -90,7 +90,7 @@
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>1.2.58</version>
<version>1.2.70</version>
<exclusions>
<exclusion>
<artifactId>fastjson</artifactId>
Expand Down
1 change: 1 addition & 0 deletions resources-front-end/src/styles/details.scss
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ $link: #409eff;
}
.prop-dataset {
max-width: calc(100% - 85px);
min-width: calc(100% - 85px);
.prop-dataset-item {
text-overflow: ellipsis;
white-space: nowrap;
Expand Down
8 changes: 3 additions & 5 deletions resources-front-end/src/utils/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,9 @@ export function filterLineArr(arr) {
}

export function initWebSocket(url, onopen, onmessage, onclose = null) {
const instance = new WebSocket('ws://127.0.0.1:8080' + url)
// const instance = new WebSocket('ws://127.0.0.1:8080' + url)
// const baseUrl = window.location.origin
// const baseWsUrl = baseUrl.replace(/http|https/g, 'ws')
// const instance = new WebSocket(baseWsUrl + url)
const baseUrl = window.location.origin
const baseWsUrl = baseUrl.replace(/http|https/g, 'ws')
const instance = new WebSocket(baseWsUrl + url)
instance.onopen = onopen
instance.onmessage = onmessage
instance.onerror = () => {
Expand Down
5 changes: 1 addition & 4 deletions resources-front-end/src/utils/request.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,7 @@ import { Message } from 'element-ui'
// create an axios instance
// console.log(window.location.origin)
const service = axios.create({
// baseURL: 'http://127.0.0.1:8080',
// baseURL: 'http://127.0.0.1:8080',
baseURL: 'http://127.0.0.1:8080',
// baseURL: window.location.origin,
baseURL: window.location.origin,
withCredentials: false,
timeout: 20000 // request timeout
})
Expand Down
20 changes: 10 additions & 10 deletions resources-front-end/src/views/job-dashboard/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -675,16 +675,16 @@ export default {
color: #4159D1;
}
.el-tooltip__popper[x-placement^=top] .popper__arrow::after {
border-top-color: rgba(127,125,142,0.7)
}
// .el-tooltip__popper[x-placement^=top] .popper__arrow::after {
// border-top-color: rgba(127,125,142,0.7)
// }
.el-tooltip__popper[x-placement^=top] .popper__arrow {
border-top-color: rgba(127,125,142,0.7)
}
// .el-tooltip__popper[x-placement^=top] .popper__arrow {
// border-top-color: rgba(127,125,142,0.7)
// }
.tooltip-content {
font-family: 'Lato';
background-color:rgba(127,125,142,0.7) !important
}
// .tooltip-content {
// font-family: 'Lato';
// background-color:rgba(127,125,142,0.7) !important
// }
</style>
2 changes: 1 addition & 1 deletion resources-front-end/src/views/job-details/ModelOutput.vue
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@
</div>
<p v-if="filterForStepwise" class="model-text" style="color: #3e4052;font-family: 'Roboto';font-weight: bold;margin-bottom: 12px;">The Final Model Information:</p>
<p v-if="LRSelect.length > 0 && role === 'guest'" class="model-text" style="margin-bottom: 0">model label: {{ lrModelChooseItem.replace(/^.+\:/, '') }}</p>
<p class="model-text" style="margin-bottom: 0">max iterations: {{ LRIters }}</p>
<p class="model-text" style="margin-bottom: 0">iterations: {{ LRIters }}</p>
<p class="model-text">converged: {{ LRisConverged }}</p>
<pagination-table
:table-data="LRtData"
Expand Down
28 changes: 21 additions & 7 deletions resources-front-end/src/views/job-details/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@
<li class="inline-row" style="margin-bottom: 0px;">
<div class="prop inline-prop">dataset:</div>
<div class="flex flex-col flex-start prop-content prop-dataset">
<el-popover v-for="(item, index) in showingRoleList" :key="index" :content="item" :disabled="popover[index]" trigger="hover" placement="right" effect="light">
<span slot="reference" :id="'spanPopOver' + index" class="prop-dataset-item">{{ item }}</span>
</el-popover>
<el-tooltip v-for="(item, index) in showingRoleList" :key="index" :content="item" :disabled="popover[index]" placement="right">
<p :id="'spanPopOver' + index" class="prop-dataset-item">{{ item }}</p>
</el-tooltip>
<el-popover
v-if="thisRoleList.length > 3"
placement="right-start"
Expand Down Expand Up @@ -89,7 +89,11 @@
<p> {{ dataset.name }} </p>
</el-col>
<el-col :span="12" :offset="4">
<p> {{ dataset.dataset }} </p>
<div class="flex flex-col">
<p v-for="(item, index) in checkDataSetForOther(dataset.dataset)" :key="index">
{{ item }}
</p>
</div>
</el-col>
</el-row>
</div>
Expand Down Expand Up @@ -375,12 +379,19 @@ export default {
}
}
}
const check = []
let check = []
for (const val of final) {
for (const item of val.datasetList) {
check.push(item.dataset)
}
}
const len = check.length
for (let i = 0; i < len; i++) {
const item = check.splice(0, 1)
for (const val of item) {
check = check.concat(val.split(','))
}
}
return check
},
showingRoleList() {
Expand Down Expand Up @@ -447,9 +458,9 @@ export default {
shouldShowPopover(item, id) {
const ctx = document.getElementById('historyForDetail').getContext('2d')
for (let i = 0; i < this.showingRoleList.length; i++) {
const width = this.measureText(ctx, this.showingRoleList[i] || '', { font: (12 * 1.14) + 'px roboto_bold' }).width
const width = this.measureText(ctx, this.showingRoleList[i] || '', { font: (12 * 1.14) + 'px roboto_regular' }).width
const acWidth = parseInt(getComputedStyle(document.getElementById('spanPopOver' + i)).width.replace('px', ''))
this.popover[i] = acWidth > width
this.popover.splice(i, 1, acWidth > width)
}
},
notesHint() {
Expand All @@ -464,6 +475,9 @@ export default {
}
return ctx.measureText(text)
},
checkDataSetForOther(dataset) {
return dataset.split(',')
},
getDatasetInfo(refresh = false) {
const vm = this
const para = {
Expand Down
6 changes: 1 addition & 5 deletions resources-front-end/src/views/job-running/JobRunning.vue
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,7 @@ export default {
}
},
mouseoverHandler() {
if (this.status === 'waiting') {
this.mouseoverd = false
} else {
this.mouseoverd = true
}
this.mouseoverd = true
},
killOperation() {
this.$emit('kill')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import com.webank.ai.fate.board.global.ErrorCode;
import com.webank.ai.fate.board.global.ResponseResult;
import com.webank.ai.fate.board.log.LogFileService;
import com.webank.ai.fate.board.pojo.FuzzyLogQO;
import com.webank.ai.fate.board.pojo.SshInfo;
import com.webank.ai.fate.board.ssh.SshService;
import com.webank.ai.fate.board.utils.GetSystemInfo;
Expand All @@ -28,11 +29,9 @@
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.*;

import javax.xml.ws.Response;
import java.io.*;
import java.util.List;
import java.util.Map;
Expand Down Expand Up @@ -75,7 +74,6 @@ public ResponseResult queryLogWithSizeSSH(@PathVariable String componentId,

}


@RequestMapping(value = "/queryLogSize/{jobId}/{role}/{partyId}/{componentId}/{type}", method = RequestMethod.GET)
@ResponseBody
public ResponseResult queryLogSize(@PathVariable String componentId,
Expand Down Expand Up @@ -145,7 +143,7 @@ List<Map> queryLog(String componentId, String jobId, String type, String role, S
if (begin > end || begin <= 0) {
throw new Exception();
}
String[] cmd = {"sh", "-c", "tail -n +" + begin + " " + filePath + " | head -n " + (end - begin)};
String[] cmd = {"sh", "-c", "tail -n +" + begin + " " + filePath + " | head -n " + (end - begin + 1)};
Process process = Runtime.getRuntime().exec(cmd);
InputStream inputStream = process.getInputStream();
BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream));
Expand All @@ -163,11 +161,20 @@ List<Map> queryLog(String componentId, String jobId, String type, String role, S
logger.debug("execute cmd {} return count {}", cmd, index);
}
} finally {
if (inputStream != null) {
try {
reader.close();
} catch (IOException e) {
e.printStackTrace();
}
try {
inputStream.close();
} catch (IOException e) {
e.printStackTrace();
}
if (process != null) {
try {
process.destroyForcibly();
} catch (Exception e) {
e.printStackTrace();
}
}
return result;
Expand All @@ -184,6 +191,62 @@ List<Map> queryLog(String componentId, String jobId, String type, String role, S

}

private List<Map> queryFuzzyLog(String componentId, String jobId, String type, String role, String partyId, String condition, Integer begin, Integer end) throws Exception {
String filePath = logFileService.buildFilePath(jobId, componentId, type, role, partyId);
// Preconditions.checkArgument(filePath != null && 0!=filePath.trim().length());
Preconditions.checkArgument(StringUtils.isNoneEmpty(condition, filePath));
Preconditions.checkArgument(begin != null && end != null);
Preconditions.checkArgument(end > begin && begin > 0);

if (LogFileService.checkFileIsExist(filePath)) {
List<Map> result = Lists.newArrayList();

String[] cmd = {"sh", "-c", "grep -n " + condition + " " + filePath + " | tail -n +" + begin + " | head -n " + (end - begin + 1)};
Process process = Runtime.getRuntime().exec(cmd);
InputStream inputStream = process.getInputStream();
BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream));
try {
String content = null;
do {
content = reader.readLine();
if (content != null) {
int i = content.indexOf(":");
String lineNumber = content.substring(0, i);
String lineContent = content.substring(i + 1);
result.add(LogFileService.toLogMap(lineContent, Long.parseLong(lineNumber)));
}
} while (content != null);
logger.info("execute cmd : {} ", (Object) cmd);
} finally {
try {
reader.close();
} catch (IOException e) {
e.printStackTrace();
}
try {
inputStream.close();
} catch (IOException e) {
e.printStackTrace();
}
try {
process.destroyForcibly();
} catch (Exception e) {
e.printStackTrace();
}
}
return result;
} else {
String ip = logFileService.getJobTaskInfo(jobId, componentId, role, partyId).ip;
if (StringUtils.isEmpty(ip)) {
return null;
}
logFileService.checkSshInfo(ip);
List<Map> remoteFuzzyLog = logFileService.getRemoteFuzzyLog(filePath, ip, condition, begin, end);
return remoteFuzzyLog;

}

}

@RequestMapping(value = "/queryLogWithSize/{jobId}/{role}/{partyId}/{componentId}/{type}/{begin}/{end}", method = RequestMethod.GET)
@ResponseBody
Expand All @@ -202,4 +265,20 @@ public ResponseResult queryLogWithSize(@PathVariable String componentId,
return new ResponseResult<>(ErrorCode.SUCCESS, result);
}

@RequestMapping(value = "/queryFuzzyLog", method = RequestMethod.POST)
@ResponseBody
public ResponseResult queryFuzzyLog(@RequestBody FuzzyLogQO fuzzyLogQO) throws Exception {
logger.info("RequestBody: queryFuzzyLog {}", fuzzyLogQO);
List<Map> result = this.queryFuzzyLog(fuzzyLogQO.getComponentId(), fuzzyLogQO.getJobId(), fuzzyLogQO.getType(), fuzzyLogQO.getRole(), fuzzyLogQO.getPartyId(), fuzzyLogQO.getCondition(), fuzzyLogQO.getBegin(), fuzzyLogQO.getEnd());
return new ResponseResult<>(ErrorCode.SUCCESS, result);
}

@RequestMapping(value = "/queryFuzzyLogSize", method = RequestMethod.POST)
@ResponseBody
public ResponseResult queryFuzzyLogSize(@RequestBody FuzzyLogQO fuzzyLogQO) throws Exception {
logger.info("RequestBody: queryFuzzyLogSize {}", fuzzyLogQO);
long size = logFileService.queryFuzzyLogSize(fuzzyLogQO.getComponentId(), fuzzyLogQO.getJobId(), fuzzyLogQO.getType(), fuzzyLogQO.getRole(), fuzzyLogQO.getPartyId(), fuzzyLogQO.getCondition());
return new ResponseResult<>(ErrorCode.SUCCESS, size);
}

}
Loading

0 comments on commit d2552c0

Please sign in to comment.