Commit 7e3b8055 by guominglei

修改项目结构

parent 3ee385aa
......@@ -6,6 +6,8 @@ import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
/**
* 全局结果集封装
* @author huangfu
......@@ -14,7 +16,8 @@ import lombok.NoArgsConstructor;
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class ResponseResult<T> {
public class ResponseResult<T> implements Serializable {
private static final long serialVersionUID = 3L;
private String code;
private T result;
......
......@@ -14,12 +14,6 @@
<dependencies>
<!-- spring-context -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>myth-job</groupId>
......@@ -43,25 +37,35 @@
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis</artifactId>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-autoconfigure</artifactId>
<groupId>myth-job</groupId>
<artifactId>myth-dto-core</artifactId>
<version>1.0-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>myth-job</groupId>
<artifactId>myth-core-common</artifactId>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
</dependency>
</dependencies>
<distributionManagement>
<repository>
<id>releases</id>
<url>http://10.0.120.2/repository/maven-releases/</url>
</repository>
<snapshotRepository>
<id>snapshots</id>
<url>http://10.0.120.2/repository/maven-snapshots/</url>
</snapshotRepository>
</distributionManagement>
<build>
<plugins>
<!--<plugin>
......
package com.test;
import com.byit.executor.jobExecutor.process.MythJobProcess;
import lombok.extern.slf4j.Slf4j;
import java.io.IOException;
import java.util.*;
/**
* @description:
* @author: gml
* @create: 2020-01-15 11:10
*/
@Slf4j
public class Test {
public static void main(String[] args) throws IOException, InterruptedException {
List<MythJobProcess> list = new ArrayList<>();
Thread thread = new Thread(() -> {
List<String> cmdList = Arrays.asList("python D:\\2020project\\byit-myth-job\\byit-myth-core\\myth-executor-core\\src\\test\\java\\com\\test\\test-ex.py".split(" "));;
MythJobProcess mythJobProcess = new MythJobProcess(cmdList, null, null, 0,"", null);
list.add(mythJobProcess);
String log = mythJobProcess.call();
System.out.println("运行日志" + log+"--");
System.out.println(mythJobProcess.getProcessId());
});
thread.start();
// Thread.sleep(30000);
//
// list.forEach(process -> {
// process.hardKill();
// });
}
}
package com.test;
import com.byit.filesystem.FastDfsFileSystem;
import org.apache.commons.io.FileUtils;
import org.csource.common.MyException;
import java.io.File;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
public class Test1 {
public static void main(String[] args) throws IOException, MyException {
FastDfsFileSystem fds = new FastDfsFileSystem();
/*fds.fileRemove("ddmp/M00/00/00/CgB4Al5wNyeAZdkbAAAAb-omIFM6333.py");
fds.fileRemove("ddmp/M00/00/00/CgB4Al5wNyeANch6AAAAb1xkZcY9815.py");
fds.fileRemove("ddmp/M00/00/00/CgB4Al5wNyeAY9HjAAAAbzGlprU0241.py");
fds.fileRemove("ddmp/M00/00/00/CgB4Al5wNyeASM74AAAAb-uR6K03377.py");
fds.fileRemove("ddmp/M00/00/00/CgB4Al5wNyiAPlYXAAAAb4ZQK943410.py");
fds.fileRemove("ddmp/M00/00/00/CgB4Al5wNyiAc_nJAAAAbzASbks9878.py");
fds.fileRemove("ddmp/M00/00/00/CgB4Al5wNyiABB-kAAAAb13TrTg1071.py");
fds.fileRemove("ddmp/M00/00/00/CgB4Al5wNyiARAFVAAAAb18L9Do3337.py");
fds.fileRemove("ddmp/M00/00/00/CgB4Al5wNyiACVSEAAAAbzLKN0k8232.py");
fds.fileRemove("ddmp/M00/00/00/CgB4Al5wNyiAZbfWAAAAcK8DUJU5054.py");
fds.fileRemove("ddmp/M00/00/00/CgB4Al5wNyiAZnPBAAAAcMLCk-Y6177.py");
fds.fileRemove("ddmp/M00/00/00/CgB4Al5wODWAePJQAAAAHSB_HGI4727.py");
fds.fileRemove("ddmp/M00/00/00/CgB4Al5wODWAFdLWAAAAG7nO0c08696.py");*/
/*byte[] bytes1 = FileUtils.readFileToByteArray(new File("C:\\Users\\Administrator\\Desktop\\script/node1.py"));
Map<String,String> map1 = new HashMap<>();
map1.put("filename","node1.py");
System.out.println(fds.uploadFile(bytes1, "py", map1));
byte[] bytes2 = FileUtils.readFileToByteArray(new File("C:\\Users\\Administrator\\Desktop\\script/node2.py"));
Map<String,String> map2 = new HashMap<>();
map2.put("filename","node2.py");
System.out.println(fds.uploadFile(bytes2, "py", map2));
byte[] bytes3 = FileUtils.readFileToByteArray(new File("C:\\Users\\Administrator\\Desktop\\script/node3.py"));
Map<String,String> map3 = new HashMap<>();
map3.put("filename","node3.py");
System.out.println(fds.uploadFile(bytes3, "py", map3));
byte[] bytes4 = FileUtils.readFileToByteArray(new File("C:\\Users\\Administrator\\Desktop\\script/node4.py"));
Map<String,String> map4 = new HashMap<>();
map4.put("filename","node4.py");
System.out.println(fds.uploadFile(bytes4, "py", map4));
byte[] bytes5 = FileUtils.readFileToByteArray(new File("C:\\Users\\Administrator\\Desktop\\script/node5.py"));
Map<String,String> map5 = new HashMap<>();
map5.put("filename","node5.py");
System.out.println(fds.uploadFile(bytes5, "py", map5));
byte[] bytes6 = FileUtils.readFileToByteArray(new File("C:\\Users\\Administrator\\Desktop\\script/node6.py"));
Map<String,String> map6 = new HashMap<>();
map6.put("filename","node6.py");
System.out.println(fds.uploadFile(bytes6, "py", map6));
byte[] bytes7 = FileUtils.readFileToByteArray(new File("C:\\Users\\Administrator\\Desktop\\script/node7.py"));
Map<String,String> map7 = new HashMap<>();
map7.put("filename","node7.py");
System.out.println(fds.uploadFile(bytes7, "py", map7));
byte[] bytes8 = FileUtils.readFileToByteArray(new File("C:\\Users\\Administrator\\Desktop\\script/node8.py"));
Map<String,String> map8 = new HashMap<>();
map8.put("filename","node8.py");
System.out.println(fds.uploadFile(bytes8, "py", map8));
byte[] bytes9 = FileUtils.readFileToByteArray(new File("C:\\Users\\Administrator\\Desktop\\script/node9.py"));
Map<String,String> map9 = new HashMap<>();
map9.put("filename","node9.py");
System.out.println(fds.uploadFile(bytes9, "py", map9));
byte[] bytes10 = FileUtils.readFileToByteArray(new File("C:\\Users\\Administrator\\Desktop\\script/node10.py"));
Map<String,String> map10 = new HashMap<>();
map10.put("filename","node10.py");
System.out.println(fds.uploadFile(bytes10, "py", map10));
byte[] bytes11 = FileUtils.readFileToByteArray(new File("C:\\Users\\Administrator\\Desktop\\script/node11.py"));
Map<String,String> map11 = new HashMap<>();
map11.put("filename","node11.py");
System.out.println(fds.uploadFile(bytes11, "py", map11));*/
byte[] bytes1 = FileUtils.readFileToByteArray(new File("C:\\Users\\Administrator\\Desktop\\script/start.py"));
Map<String,String> map1 = new HashMap<>();
map1.put("filename","start.py");
System.out.println(fds.uploadFile(bytes1, "py", map1));
byte[] bytes2 = FileUtils.readFileToByteArray(new File("C:\\Users\\Administrator\\Desktop\\script/end.py"));
Map<String,String> map2 = new HashMap<>();
map2.put("filename","end.py");
System.out.println(fds.uploadFile(bytes2, "py", map2));
}
}
......@@ -20,6 +20,11 @@
</dependency>
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-all</artifactId>
</dependency>
......@@ -30,10 +35,10 @@
</dependency>
<!-- slf4j -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
<!-- <dependency>-->
<!-- <groupId>org.slf4j</groupId>-->
<!-- <artifactId>slf4j-api</artifactId>-->
<!-- </dependency>-->
<!--<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
......@@ -65,32 +70,32 @@
</distributionManagement>
<build>
<finalName>${project.artifactId}</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>2.4.3</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
<resource>META-INF/spring.handlers</resource>
</transformer>
<transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
<resource>META-INF/spring.schemas</resource>
</transformer>
</transformers>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<!-- <build>-->
<!-- <finalName>${project.artifactId}</finalName>-->
<!-- <plugins>-->
<!-- <plugin>-->
<!-- <groupId>org.apache.maven.plugins</groupId>-->
<!-- <artifactId>maven-shade-plugin</artifactId>-->
<!-- <version>2.4.3</version>-->
<!-- <executions>-->
<!-- <execution>-->
<!-- <phase>package</phase>-->
<!-- <goals>-->
<!-- <goal>shade</goal>-->
<!-- </goals>-->
<!-- <configuration>-->
<!-- <transformers>-->
<!-- <transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">-->
<!-- <resource>META-INF/spring.handlers</resource>-->
<!-- </transformer>-->
<!-- <transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">-->
<!-- <resource>META-INF/spring.schemas</resource>-->
<!-- </transformer>-->
<!-- </transformers>-->
<!-- </configuration>-->
<!-- </execution>-->
<!-- </executions>-->
<!-- </plugin>-->
<!-- </plugins>-->
<!-- </build>-->
</project>
\ No newline at end of file
......@@ -103,8 +103,12 @@ public class JobUtils {
private static String createHttpRequest(String requestUrl, String body){
ValidationUtil.dataNotBank(REQUEST_URL, "请求调度中心的地址尚未设置!");
ValidationUtil.dataNotBank(TOKEN, "请求的token尚未设置!");
if (null == REQUEST_URL || REQUEST_URL.equals("")){
throw new RuntimeException("请求调度中心的地址尚未设置!");
}
if (null == TOKEN || TOKEN.equals("")){
throw new RuntimeException("请求的token尚未设置!");
}
HttpRequest httpRequest = HttpRequest.post(REQUEST_URL + requestUrl);
httpRequest.header("token", TOKEN);
String response = httpRequest.body(body).execute().body();
......
......@@ -45,6 +45,11 @@
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis</artifactId>
</dependency>
</dependencies>
<build>
......
package com.byit.executor.config;
package com.byit.config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
......
package com.byit.controller;
import com.byit.executor.jobExecutor.process.MythJobProcess;
import com.byit.executor.util.JobContentUtil;
import com.byit.process.MythJobProcess;
import com.byit.utils.JobContentUtil;
import com.byit.utils.ValidationUtil;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
......
package com.byit.executor.jobExecutor.process;
package com.byit.process;
import com.alibaba.fastjson.JSON;
import com.byit.dto.plugin.RunLog;
import com.byit.executor.util.JobContentUtil;
import com.byit.executor.util.LogGobbler;
import com.byit.utils.JobContentUtil;
import com.byit.utils.LogGobbler;
import com.google.common.base.Joiner;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import org.springframework.data.redis.core.StringRedisTemplate;
import javax.annotation.Resource;
import java.io.File;
import java.io.IOException;
import java.io.InputStreamReader;
......
......@@ -6,8 +6,8 @@ import com.byit.dto.executor.JobRunResultDto;
import com.byit.dto.executor.ScriptDto;
import com.byit.dto.executor.ScriptParamAndPlaceholderDto;
import com.byit.executor.api.ScriptExecutorService;
import com.byit.executor.jobExecutor.process.MythJobProcess;
import com.byit.executor.jobExecutor.process.ProcessFailureException;
import com.byit.process.MythJobProcess;
import com.byit.process.ProcessFailureException;
import com.byit.filesystem.FileSystem;
import com.byit.enums.JobResultEnum;
import com.byit.job.utils.PlaceholderUtils;
......
package com.byit.executor.util;
package com.byit.utils;
import com.byit.executor.jobExecutor.process.MythJobProcess;
import com.byit.process.MythJobProcess;
import java.util.HashMap;
......
package com.byit.executor.util;
package com.byit.utils;
import com.alibaba.fastjson.JSON;
import com.byit.dto.plugin.RunLog;
import lombok.extern.slf4j.Slf4j;
import org.springframework.data.redis.core.StringRedisTemplate;
import javax.annotation.Resource;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.Reader;
import java.io.UnsupportedEncodingException;
import static com.alibaba.fastjson.serializer.SerializerFeature.WriteClassName;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment