|
|
@ -57,15 +57,15 @@ public class StuJupyterController {
|
|
|
|
private AdminJupyterTokenMapper adminJupyterTokenMapper;
|
|
|
|
private AdminJupyterTokenMapper adminJupyterTokenMapper;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Scheduled(cron = "0 0 0 * * ?")
|
|
|
|
@Scheduled(cron = "0 30 12 * * ?")
|
|
|
|
public void updateToken() throws IOException, InterruptedException {
|
|
|
|
public void updateToken() throws IOException, InterruptedException {
|
|
|
|
|
|
|
|
|
|
|
|
log.info("定时任务:==================获取jupyterToken======================");
|
|
|
|
log.info("定时任务:==================获取jupyterToken======================");
|
|
|
|
|
|
|
|
|
|
|
|
// //删除全部文件
|
|
|
|
// //删除全部文件
|
|
|
|
// AdminJupyterTokenExample tokenExample = new AdminJupyterTokenExample();
|
|
|
|
AdminJupyterTokenExample tokenExample = new AdminJupyterTokenExample();
|
|
|
|
// tokenExample.createCriteria().getAllCriteria();
|
|
|
|
tokenExample.createCriteria().getAllCriteria();
|
|
|
|
// adminJupyterTokenMapper.deleteByExample(tokenExample);
|
|
|
|
adminJupyterTokenMapper.deleteByExample(tokenExample);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String[] command = {"docker", "exec", "jupytertch", "jupyter", "server", "list"};
|
|
|
|
String[] command = {"docker", "exec", "jupytertch", "jupyter", "server", "list"};
|
|
|
@ -98,8 +98,6 @@ public class StuJupyterController {
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String[] commandStu = {"docker", "exec", "jupyterstu", "jupyter", "server", "list"};
|
|
|
|
String[] commandStu = {"docker", "exec", "jupyterstu", "jupyter", "server", "list"};
|
|
|
|
|
|
|
|
|
|
|
|
Map map1 = connectdocker(commandStu);
|
|
|
|
Map map1 = connectdocker(commandStu);
|
|
|
@ -200,9 +198,9 @@ public class StuJupyterController {
|
|
|
|
// 等待进程执行完成
|
|
|
|
// 等待进程执行完成
|
|
|
|
int exitCodeInfo = process.waitFor();
|
|
|
|
int exitCodeInfo = process.waitFor();
|
|
|
|
if (exitCodeInfo == 0) {
|
|
|
|
if (exitCodeInfo == 0) {
|
|
|
|
return new ResultEntity<>(HttpStatus.OK, "导出成功");
|
|
|
|
return new ResultEntity<>(HttpStatus.OK, "发布成功");
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
return new ResultEntity<>(HttpStatus.BAD_REQUEST, "导出失败!请联系管理员");
|
|
|
|
return new ResultEntity<>(HttpStatus.BAD_REQUEST, "发布失败!请联系管理员");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
@ -210,7 +208,7 @@ public class StuJupyterController {
|
|
|
|
Object err = map.get("errors");
|
|
|
|
Object err = map.get("errors");
|
|
|
|
String errors = Convert.toStr(err);
|
|
|
|
String errors = Convert.toStr(err);
|
|
|
|
System.err.println("Error executing Python code:\n" + errors.toString());
|
|
|
|
System.err.println("Error executing Python code:\n" + errors.toString());
|
|
|
|
return new ResultEntity(HttpStatus.OK, errors.toString());
|
|
|
|
return new ResultEntity(HttpStatus.BAD_REQUEST, "发布失败!请联系管理员");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -267,7 +265,7 @@ public class StuJupyterController {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
return new ResultEntity<>(HttpStatus.OK, "文件不存在!", false);
|
|
|
|
return new ResultEntity<>(HttpStatus.BAD_REQUEST, "文件不存在!", false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
System.out.println("该目录不存在或不是一个目录");
|
|
|
|
System.out.println("该目录不存在或不是一个目录");
|
|
|
@ -539,9 +537,9 @@ public class StuJupyterController {
|
|
|
|
// 等待进程执行完成
|
|
|
|
// 等待进程执行完成
|
|
|
|
int exitCodeInfo = process.waitFor();
|
|
|
|
int exitCodeInfo = process.waitFor();
|
|
|
|
if (exitCodeInfo == 0) {
|
|
|
|
if (exitCodeInfo == 0) {
|
|
|
|
return new ResultEntity<>(HttpStatus.OK, "导出成功");
|
|
|
|
return new ResultEntity<>(HttpStatus.OK, "更新成功");
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
return new ResultEntity<>(HttpStatus.BAD_REQUEST, "导出失败!请联系管理员");
|
|
|
|
return new ResultEntity<>(HttpStatus.BAD_REQUEST, "更新失败!请联系管理员");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
return new ResultEntity<>(HttpStatus.OK,"更新成功!");
|
|
|
|
return new ResultEntity<>(HttpStatus.OK,"更新成功!");
|
|
|
@ -552,7 +550,7 @@ public class StuJupyterController {
|
|
|
|
Object err = map.get("errors");
|
|
|
|
Object err = map.get("errors");
|
|
|
|
String errors = Convert.toStr(err);
|
|
|
|
String errors = Convert.toStr(err);
|
|
|
|
System.err.println("Error executing Python code:\n" + errors.toString());
|
|
|
|
System.err.println("Error executing Python code:\n" + errors.toString());
|
|
|
|
return new ResultEntity(HttpStatus.OK, errors.toString());
|
|
|
|
return new ResultEntity(HttpStatus.BAD_REQUEST, "更新失败!");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|