mirror of
https://github.com/PowerJob/PowerJob.git
synced 2025-07-17 00:00:04 +08:00
[dev] finished omsOnlineLog, try to opt stop instance
This commit is contained in:
parent
c074f64d30
commit
9ad07c5b8d
@ -97,7 +97,7 @@ public class InstanceLogService {
|
||||
/**
|
||||
* 获取任务实例运行日志(默认存在本地数据,需要由生成完成请求的路由与转发)
|
||||
* @param instanceId 任务实例ID
|
||||
* @param index 页码
|
||||
* @param index 页码,从0开始
|
||||
* @return 文本字符串
|
||||
*/
|
||||
public StringPage fetchInstanceLog(Long instanceId, long index) {
|
||||
|
@ -95,18 +95,16 @@ public class InstanceController {
|
||||
return ResultDTO.success(instanceLogService.fetchInstanceLog(instanceId, index));
|
||||
}
|
||||
|
||||
@GetMapping("/downloadLogUrl")
|
||||
public ResultDTO<String> getDownloadUrl(Long instanceId) {
|
||||
String targetServer = getTargetServer(instanceId);
|
||||
String ip = targetServer.split(":")[0];
|
||||
String url = "http://" + ip + ":" + port + "/instance/downloadLog?instanceId=" + instanceId;
|
||||
return ResultDTO.success(url);
|
||||
}
|
||||
|
||||
@GetMapping("/downloadLog")
|
||||
public void downloadLogFile(Long instanceId , HttpServletResponse response) throws Exception {
|
||||
String targetServer = getTargetServer(instanceId);
|
||||
// 转发HTTP请求(如果使用Akka,则需要传输两次,而转发HTTP请求只需要传输一次"大"数据包)
|
||||
if (!OhMyServer.getActorSystemAddress().equals(targetServer)) {
|
||||
String ip = targetServer.split(":")[0];
|
||||
String url = "http://" + ip + ":" + port + "/instance/downloadLog?instanceId=" + instanceId;
|
||||
try {
|
||||
response.sendRedirect(url);
|
||||
}catch (Exception ignore) {
|
||||
}
|
||||
}
|
||||
|
||||
File file = instanceLogService.downloadInstanceLog(instanceId);
|
||||
response.setContentType("application/octet-stream");
|
||||
|
Loading…
x
Reference in New Issue
Block a user