diff --git a/README.md b/README.md index ab6314d5..5c25514f 100644 --- a/README.md +++ b/README.md @@ -58,7 +58,7 @@ Application password: 123 | Distributed strategy | Unsupported | Static sharding | MapReduce dynamic sharding | **MapReduce dynamic sharding** | | Online task management | Unsupported | Supported | Supported | **Supported** | | Online logging | Unsupported | Supported | Unsupported | **Supported** | -| Scheduling methods and performance | Based on database lock, there is a performance bottleneck | Based on database lock, there is a performance bottleneck | Unknown | **Lock-free design, powerful performance without upper limit** | +| Scheduling methods and performance | Based on database lock, there is a performance bottleneck | Based on database lock, there is a performance bottleneck | Unknown | **Lock-free design, high performance without upper limit** | | Alarm monitoring | Unsupported | Email | SMS | **Email, WebHook, DingTalk. An interface is provided for customization.** | | System dependence | Any relational database (MySQL, Oracle ...) supported by JDBC | MySQL | RMB (Public Beta version for free, hey, helping to promote) | **Any relational database (MySQL, Oracle ...) supported by Spring Data Jpa** | | workflow | Unsupported | Unsupported | Supported | **Supported** | diff --git a/pom.xml b/pom.xml index 66364f71..ab4fb070 100644 --- a/pom.xml +++ b/pom.xml @@ -87,7 +87,7 @@ ${java.version} - + org.apache.maven.plugins maven-source-plugin @@ -121,9 +121,9 @@ maven-javadoc-plugin ${maven-javadoc-plugin.version} - + false - + -Xdoclint:none @@ -164,7 +164,7 @@ - + dev @@ -173,7 +173,7 @@ - + org.apache.maven.plugins maven-compiler-plugin @@ -185,7 +185,7 @@ ${java.version} - + org.apache.maven.plugins maven-jar-plugin diff --git a/powerjob-client/pom.xml b/powerjob-client/pom.xml index 8a8a6621..71f1c2ba 100644 --- a/powerjob-client/pom.xml +++ b/powerjob-client/pom.xml @@ -37,7 +37,7 @@ ${powerjob.common.version} - + org.junit.jupiter junit-jupiter-api diff --git a/powerjob-client/src/main/java/com/github/kfcfans/powerjob/client/OhMyClient.java b/powerjob-client/src/main/java/com/github/kfcfans/powerjob/client/OhMyClient.java index d7c3bfb4..9a8a980e 100644 --- a/powerjob-client/src/main/java/com/github/kfcfans/powerjob/client/OhMyClient.java +++ b/powerjob-client/src/main/java/com/github/kfcfans/powerjob/client/OhMyClient.java @@ -25,7 +25,7 @@ import java.util.Objects; import static com.github.kfcfans.powerjob.client.TypeStore.*; /** - * OpenAPI 客户端 + * OhMyClient, the client for OpenAPI. * * @author tjq * @since 2020/4/15 @@ -40,9 +40,9 @@ public class OhMyClient { private static final String URL_PATTERN = "http://%s%s%s"; /** - * 初始化 OhMyClient 客户端 + * Init OhMyClient with domain, appName and password. * @param domain 比如 www.powerjob-server.com(内网域名,自行完成 DNS & Proxy) - * @param appName 负责的应用名称 + * @param appName name of the application */ public OhMyClient(String domain, String appName, String password) { this(Lists.newArrayList(domain), appName, password); @@ -50,9 +50,9 @@ public class OhMyClient { /** - * 初始化 OhMyClient 客户端 - * @param addressList IP:Port 列表 - * @param appName 负责的应用名称 + * nit OhMyClient with server address, appName and password. + * @param addressList IP:Port address list + * @param appName name of the application */ public OhMyClient(List addressList, String appName, String password) { @@ -199,7 +199,7 @@ public class OhMyClient { return runJob(jobId, null, 0); } - /* ************* Instance 区 ************* */ + /* ************* Instance API list ************* */ /** * 停止应用实例 * @param instanceId 应用实例ID @@ -275,7 +275,7 @@ public class OhMyClient { return JSONObject.parseObject(post, INSTANCE_RESULT_TYPE); } - /* ************* Workflow 区 ************* */ + /* ************* Workflow API list ************* */ /** * 保存工作流(包括创建和修改) * @param request 创建/修改 Workflow 请求 @@ -374,7 +374,7 @@ public class OhMyClient { return runWorkflow(workflowId, null, 0); } - /* ************* Workflow Instance 区 ************* */ + /* ************* Workflow Instance API list ************* */ /** * 停止应用实例 * @param wfInstanceId 工作流实例ID diff --git a/powerjob-client/src/main/java/com/github/kfcfans/powerjob/client/TypeStore.java b/powerjob-client/src/main/java/com/github/kfcfans/powerjob/client/TypeStore.java index 754e35ed..0c680e79 100644 --- a/powerjob-client/src/main/java/com/github/kfcfans/powerjob/client/TypeStore.java +++ b/powerjob-client/src/main/java/com/github/kfcfans/powerjob/client/TypeStore.java @@ -4,7 +4,7 @@ import com.alibaba.fastjson.TypeReference; import com.github.kfcfans.powerjob.common.response.*; /** - * 类型工厂 + * TypeReference store. * * @author tjq * @since 11/7/20 diff --git a/powerjob-client/src/test/java/TestClient.java b/powerjob-client/src/test/java/TestClient.java index f50aed98..61fae077 100644 --- a/powerjob-client/src/test/java/TestClient.java +++ b/powerjob-client/src/test/java/TestClient.java @@ -12,7 +12,7 @@ import org.junit.jupiter.api.Test; import java.util.concurrent.TimeUnit; /** - * 测试 Client + * Test cases for {@link OhMyClient} * * @author tjq * @since 2020/4/15 @@ -110,7 +110,7 @@ public class TestClient { ResultDTO startRes = ohMyClient.runJob(15L, "start by OhMyClient", 2000000); System.out.println("runJob result: " + JSONObject.toJSONString(startRes)); - // 手动重启 server,干掉时间轮中的调度数据 + // Restart server manually and clear all the data in time wheeler. TimeUnit.MINUTES.sleep(1); ResultDTO cancelRes = ohMyClient.cancelInstance(startRes.getData()); diff --git a/powerjob-client/src/test/java/TestWorkflow.java b/powerjob-client/src/test/java/TestWorkflow.java index 6feaf266..71630e7e 100644 --- a/powerjob-client/src/test/java/TestWorkflow.java +++ b/powerjob-client/src/test/java/TestWorkflow.java @@ -13,7 +13,7 @@ import org.junit.jupiter.api.Test; import java.util.List; /** - * 测试 Client(workflow部分) + * Test cases for {@link OhMyClient} workflow. * * @author tjq * @since 2020/6/2 diff --git a/powerjob-common/pom.xml b/powerjob-common/pom.xml index b1e2d8e3..22125af3 100644 --- a/powerjob-common/pom.xml +++ b/powerjob-common/pom.xml @@ -76,7 +76,7 @@ ${commons.io.version} - + org.junit.jupiter junit-jupiter-api diff --git a/powerjob-common/src/main/java/com/github/kfcfans/powerjob/common/ContainerConstant.java b/powerjob-common/src/main/java/com/github/kfcfans/powerjob/common/ContainerConstant.java index ab8cc275..06b00697 100644 --- a/powerjob-common/src/main/java/com/github/kfcfans/powerjob/common/ContainerConstant.java +++ b/powerjob-common/src/main/java/com/github/kfcfans/powerjob/common/ContainerConstant.java @@ -1,7 +1,7 @@ package com.github.kfcfans.powerjob.common; /** - * 容器常量 + * Container constants. * * @author tjq * @since 2020/5/15 @@ -9,13 +9,16 @@ package com.github.kfcfans.powerjob.common; public class ContainerConstant { /** - * spring-context 配置文件名称 + * Spring-context configuration file name of the container. */ public static final String SPRING_CONTEXT_FILE_NAME = "oms-worker-container-spring-context.xml"; /** - * container 属性文件名称 + * Property file name of the container. */ public static final String CONTAINER_PROPERTIES_FILE_NAME = "oms-worker-container.properties"; + /** + * Package name of the container. + */ public static final String CONTAINER_PACKAGE_NAME_KEY = "PACKAGE_NAME"; } diff --git a/powerjob-common/src/main/java/com/github/kfcfans/powerjob/common/Env.java b/powerjob-common/src/main/java/com/github/kfcfans/powerjob/common/Env.java index e5344061..25906112 100644 --- a/powerjob-common/src/main/java/com/github/kfcfans/powerjob/common/Env.java +++ b/powerjob-common/src/main/java/com/github/kfcfans/powerjob/common/Env.java @@ -1,13 +1,22 @@ package com.github.kfcfans.powerjob.common; /** - * 部署环境 + * Environment Enum class. * * @author tjq * @since 2020/5/3 */ public enum Env { + /** + * Development or test environment. + */ DAILY, + /** + * Pre-release environment. + */ PRE, + /** + * Production environment. + */ PRODUCT } diff --git a/powerjob-common/src/main/java/com/github/kfcfans/powerjob/common/ExecuteType.java b/powerjob-common/src/main/java/com/github/kfcfans/powerjob/common/ExecuteType.java index 5f46d9ec..7ee38b53 100644 --- a/powerjob-common/src/main/java/com/github/kfcfans/powerjob/common/ExecuteType.java +++ b/powerjob-common/src/main/java/com/github/kfcfans/powerjob/common/ExecuteType.java @@ -4,7 +4,7 @@ import lombok.AllArgsConstructor; import lombok.Getter; /** - * 任务执行类型 + * Execution type. * * @author tjq * @since 2020/3/17 @@ -12,8 +12,17 @@ import lombok.Getter; @Getter @AllArgsConstructor public enum ExecuteType { + /** + * Standalone type of task. + */ STANDALONE(1, "单机执行"), + /** + * Broadcast type of task. + */ BROADCAST(2, "广播执行"), + /** + * MapReduce type of task. + */ MAP_REDUCE(3, "MapReduce"), MAP(4, "Map"); diff --git a/powerjob-common/src/main/java/com/github/kfcfans/powerjob/common/OmsConstant.java b/powerjob-common/src/main/java/com/github/kfcfans/powerjob/common/OmsConstant.java index 3cb99e5e..a2a79fd4 100644 --- a/powerjob-common/src/main/java/com/github/kfcfans/powerjob/common/OmsConstant.java +++ b/powerjob-common/src/main/java/com/github/kfcfans/powerjob/common/OmsConstant.java @@ -1,7 +1,7 @@ package com.github.kfcfans.powerjob.common; /** - * 公共常量 + * Common constants. * * @author tjq * @since 2020/5/31 diff --git a/powerjob-common/src/main/java/com/github/kfcfans/powerjob/common/OmsSerializable.java b/powerjob-common/src/main/java/com/github/kfcfans/powerjob/common/OmsSerializable.java index 36243db5..aa132dad 100644 --- a/powerjob-common/src/main/java/com/github/kfcfans/powerjob/common/OmsSerializable.java +++ b/powerjob-common/src/main/java/com/github/kfcfans/powerjob/common/OmsSerializable.java @@ -3,7 +3,7 @@ package com.github.kfcfans.powerjob.common; import java.io.Serializable; /** - * PowerJob 序列化标记接口 + * PowerJob serializable interface. * * @author tjq * @since 2020/4/16 diff --git a/powerjob-common/src/main/java/com/github/kfcfans/powerjob/common/model/DeployedContainerInfo.java b/powerjob-common/src/main/java/com/github/kfcfans/powerjob/common/model/DeployedContainerInfo.java index 56a0c7f0..67e8deda 100644 --- a/powerjob-common/src/main/java/com/github/kfcfans/powerjob/common/model/DeployedContainerInfo.java +++ b/powerjob-common/src/main/java/com/github/kfcfans/powerjob/common/model/DeployedContainerInfo.java @@ -6,7 +6,7 @@ import lombok.Data; import lombok.NoArgsConstructor; /** - * 已部署的容器信息 + * The class for deployed container. * * @author tjq * @since 2020/5/18 @@ -16,12 +16,20 @@ import lombok.NoArgsConstructor; @AllArgsConstructor public class DeployedContainerInfo implements OmsSerializable { - // 容器ID + /** + * Id of the container. + */ private Long containerId; - // 版本 + /** + * Version of the container. + */ private String version; - // 部署时间 + /** + * Deploy timestamp. + */ private long deployedTime; - // 机器地址(无需上报) + /** + * Address of the server. Report is not required. + */ private String workerAddress; } diff --git a/powerjob-common/src/main/java/com/github/kfcfans/powerjob/common/model/GitRepoInfo.java b/powerjob-common/src/main/java/com/github/kfcfans/powerjob/common/model/GitRepoInfo.java index 2ef2fa69..0aaa5013 100644 --- a/powerjob-common/src/main/java/com/github/kfcfans/powerjob/common/model/GitRepoInfo.java +++ b/powerjob-common/src/main/java/com/github/kfcfans/powerjob/common/model/GitRepoInfo.java @@ -3,19 +3,27 @@ package com.github.kfcfans.powerjob.common.model; import lombok.Data; /** - * Git代码库信息 + * The class for Git Repository info. * * @author tjq * @since 2020/5/17 */ @Data public class GitRepoInfo { - // 仓库地址 + /** + * Address of Git repository. + */ private String repo; - // 分支名称 + /** + * Name of the branch. + */ private String branch; - // 用户名 + /** + * username of Git. + */ private String username; - // 密码 + /** + * Password of Git. + */ private String password; } diff --git a/powerjob-common/src/main/java/com/github/kfcfans/powerjob/common/model/InstanceDetail.java b/powerjob-common/src/main/java/com/github/kfcfans/powerjob/common/model/InstanceDetail.java index e690c3ab..b14ab3dc 100644 --- a/powerjob-common/src/main/java/com/github/kfcfans/powerjob/common/model/InstanceDetail.java +++ b/powerjob-common/src/main/java/com/github/kfcfans/powerjob/common/model/InstanceDetail.java @@ -7,7 +7,7 @@ import lombok.NoArgsConstructor; import java.util.List; /** - * 任务实例的运行详细信息 + * Detailed info of task instances. * * @author tjq * @since 2020/4/11 @@ -16,33 +16,62 @@ import java.util.List; @NoArgsConstructor public class InstanceDetail implements OmsSerializable { - // 任务预计执行时间 + /** + * Expected trigger time. + */ private Long expectedTriggerTime; - // 任务整体开始时间 + /** + * Actual trigger time of an instance. + */ private Long actualTriggerTime; - // 任务整体结束时间(可能不存在) + /** + * Finish time of an instance, which may be null. + */ private Long finishedTime; - // 任务状态 + /** + * Status of the task instance. + */ private Integer status; // 任务执行结果(可能不存在) + /** + * Execution result, which may be null. + */ private String result; // TaskTracker地址 + /** + * Task tracker address. + */ private String taskTrackerAddress; // 启动参数 + /** + * Param string that is passed to an instance when it is initialized. + */ private String instanceParams; - // MR或BD任务专用 + /** + * Task detail, used by MapReduce or Broadcast tasks. + */ private TaskDetail taskDetail; - // 秒级任务专用 + /** + * Sub instance details, used by frequent tasks. + */ private List subInstanceDetails; - // 重试次数 + /** + * Running times. + */ private Long runningTimes; - // 扩展字段,中间件升级不易,最好不要再改 common 包了...否则 server worker 版本不兼容 + /** + * Extended fields. Middlewares are not supposed to update frequently. + * Changes in PowerJob-common may lead to incompatible versions. + * PowerJob-common packages should not be modified if not necessary. + */ private String extra; - // 秒级任务的 extra -> List + /** + * Extra info for frequent tasks, return List. + */ @Data @NoArgsConstructor public static class SubInstanceDetail implements OmsSerializable { @@ -53,7 +82,9 @@ public class InstanceDetail implements OmsSerializable { private int status; } - // MapReduce 和 Broadcast 任务的 extra -> + /** + * Extra info of {@code MapReduce} or {@code Broadcast} type of tasks. + */ @Data @NoArgsConstructor public static class TaskDetail implements OmsSerializable { diff --git a/powerjob-common/src/main/java/com/github/kfcfans/powerjob/common/model/InstanceLogContent.java b/powerjob-common/src/main/java/com/github/kfcfans/powerjob/common/model/InstanceLogContent.java index 0be65e93..ce588945 100644 --- a/powerjob-common/src/main/java/com/github/kfcfans/powerjob/common/model/InstanceLogContent.java +++ b/powerjob-common/src/main/java/com/github/kfcfans/powerjob/common/model/InstanceLogContent.java @@ -6,7 +6,7 @@ import lombok.Data; import lombok.NoArgsConstructor; /** - * 任务实例日志对象 + * Log instance model. * * @author tjq * @since 2020/4/21 @@ -16,13 +16,21 @@ import lombok.NoArgsConstructor; @AllArgsConstructor public class InstanceLogContent implements OmsSerializable { - // 实例ID + /** + * Id of instance. + */ private long instanceId; - // 日志提交时间 + /** + * Submitted time of the log. + */ private long logTime; - // 级别 + /** + * Level of the log. + */ private int logLevel; - // 日志内容 + /** + * Content of the log. + */ private String logContent; } diff --git a/powerjob-common/src/main/java/com/github/kfcfans/powerjob/common/model/PEWorkflowDAG.java b/powerjob-common/src/main/java/com/github/kfcfans/powerjob/common/model/PEWorkflowDAG.java index 3fe258ca..f49bcacc 100644 --- a/powerjob-common/src/main/java/com/github/kfcfans/powerjob/common/model/PEWorkflowDAG.java +++ b/powerjob-common/src/main/java/com/github/kfcfans/powerjob/common/model/PEWorkflowDAG.java @@ -13,8 +13,7 @@ import java.io.Serializable; import java.util.List; /** - * Point & Edge DAG 表示法 - * 点 + 线,易于表达和传播 + * Points & edges for DAG, making it easier to describe or transfer. * * @author tjq * @since 2020/5/26 @@ -23,11 +22,18 @@ import java.util.List; @NoArgsConstructor public class PEWorkflowDAG implements Serializable { - // DAG 图(点线表示法) + /** + * Nodes of DAG diagram. + */ private List nodes; + /** + * Edges of DAG diagram. + */ private List edges; - // 点 + /** + * Point. + */ @Data @NoArgsConstructor @AllArgsConstructor @@ -35,7 +41,9 @@ public class PEWorkflowDAG implements Serializable { private Long jobId; private String jobName; - // 运行时参数,图定义不需要 + /** + * Instance running param, which is not required by DAG. + */ @JsonSerialize(using= ToStringSerializer.class) private Long instanceId; private Integer status; @@ -47,7 +55,9 @@ public class PEWorkflowDAG implements Serializable { } } - // 边 jobId -> jobId + /** + * Edge formed by two job ids. + */ @Data @NoArgsConstructor @AllArgsConstructor diff --git a/powerjob-common/src/main/java/com/github/kfcfans/powerjob/common/model/SystemMetrics.java b/powerjob-common/src/main/java/com/github/kfcfans/powerjob/common/model/SystemMetrics.java index 1d5945ec..c90534f4 100644 --- a/powerjob-common/src/main/java/com/github/kfcfans/powerjob/common/model/SystemMetrics.java +++ b/powerjob-common/src/main/java/com/github/kfcfans/powerjob/common/model/SystemMetrics.java @@ -4,7 +4,7 @@ import com.github.kfcfans.powerjob.common.OmsSerializable; import lombok.Data; /** - * 系统指标 + * Class for system metrics. * * @author tjq * @since 2020/3/25 @@ -12,49 +12,77 @@ import lombok.Data; @Data public class SystemMetrics implements OmsSerializable, Comparable { - // CPU核心数量 + /** + * CPU processor num. + */ private int cpuProcessors; - // CPU负载(负载 和 使用率 是两个完全不同的概念,Java 无法获取 CPU 使用率,只能获取负载) + /** + * Percent of CPU load. + */ private double cpuLoad; - // 内存(单位 GB) + /** + * Memory that is used by JVM, in GB. + */ private double jvmUsedMemory; + /** + * Max memory that JVM can use, in GB. + */ private double jvmMaxMemory; - // 内存占用(0.X,非百分比) + /** + * Ratio of memory that JVM uses to total memory, 0.X, + * the value is between 0 and 1. + */ private double jvmMemoryUsage; - // 磁盘(单位 GB) + /** + * Total used disk space, in GB. + */ private double diskUsed; + /** + * Total disk space, in GB. + */ private double diskTotal; - // 磁盘占用(0.X,非百分比) + /** + * Used disk ratio. + */ private double diskUsage; - // 缓存分数 + /** + * Score of cache. + */ private int score; + /** + * Override compareTo. + * + * @param that the metrics that is to be compared with current. + * @return {@code int} + */ @Override public int compareTo(SystemMetrics that) { - // 降序排列 + // Sort by metrics in descending order. return that.calculateScore() - this.calculateScore(); } /** - * 计算得分情况,内存 & CPU (磁盘不参与计算) - * @return 得分情况 + * Calculate score, based on CPU and memory info. + * + * @return score */ public int calculateScore() { - if (score > 0) { - return score; - } + if (score > 0) { + return score; + } - // 对于 TaskTracker 来说,内存是任务顺利完成的关键,因此内存 2 块钱 1GB - double memScore = (jvmMaxMemory - jvmUsedMemory) * 2; - // CPU 剩余负载,1 块钱 1 斤 - double cpuScore = cpuProcessors - cpuLoad; - // Indian Windows 无法获取 CpuLoad,为 -1,固定为 1 - if (cpuScore > cpuProcessors) { - cpuScore = 1; + // Memory is vital to TaskTracker, so we set the multiplier factor as 2. + double memScore = (jvmMaxMemory - jvmUsedMemory) * 2; + // Calculate the remaining load of CPU. Multiplier is set as 1. + double cpuScore = cpuProcessors - cpuLoad; + // Windows can not fetch CPU load, set cpuScore as 1. + if (cpuScore > cpuProcessors) { + cpuScore = 1; } score = (int) (memScore + cpuScore); @@ -62,11 +90,12 @@ public class SystemMetrics implements OmsSerializable, Comparable } /** - * 该机器是否可用 - * @param minCPUCores 判断标准之最低可用CPU核心数量 + * Judge if the machine is available. + * + * @param minCPUCores Minimum available CPU cores. * @param minMemorySpace 判断标准之最低可用内存 - * @param minDiskSpace 判断标准之最低可用磁盘空间 - * @return 是否可用 + * @param minDiskSpace Minimum disk space 判断标准之最低可用磁盘空间 + * @return {@code boolean} whether the machine is available. */ public boolean available(double minCPUCores, double minMemorySpace, double minDiskSpace) { @@ -77,7 +106,8 @@ public class SystemMetrics implements OmsSerializable, Comparable return false; } - // cpuLoad 为负数代表无法获取,不判断。等于 0 为最理想情况,CPU 空载,不需要判断 + // Negative number means being unable to fetch CPU info, return true. + // 0 indicates the CPU is free, which is the optimal condition. if (cpuLoad <= 0 || minCPUCores <= 0) { return true; } diff --git a/powerjob-common/src/main/java/com/github/kfcfans/powerjob/common/request/http/SaveJobInfoRequest.java b/powerjob-common/src/main/java/com/github/kfcfans/powerjob/common/request/http/SaveJobInfoRequest.java index ae7a24e2..2bc8435f 100644 --- a/powerjob-common/src/main/java/com/github/kfcfans/powerjob/common/request/http/SaveJobInfoRequest.java +++ b/powerjob-common/src/main/java/com/github/kfcfans/powerjob/common/request/http/SaveJobInfoRequest.java @@ -9,7 +9,7 @@ import lombok.Data; import java.util.List; /** - * 创建/修改 JobInfo 请求 + * Save or modify {@link com.github.kfcfans.powerjob.common.response.JobInfoDTO} * * @author tjq * @since 2020/3/30 @@ -17,68 +17,122 @@ import java.util.List; @Data public class SaveJobInfoRequest { - // 任务ID(jobId),null -> 插入,否则为更新 + /** + * id of the job. set null to save or non-null to update the job. + */ private Long id; - /* ************************** 任务基本信息 ************************** */ - // 任务名称 + /* ************************** Base info of related job. ************************** */ + + /** + * Name of the job. + */ private String jobName; - // 任务描述 + /** + * Description of the job. + */ private String jobDescription; - // 任务所属的应用ID(Client无需填写该参数,自动填充) + /** + * Related id of the application. There is not need to set this property + * in PowerJob-client, as it would be set automatically. + */ private Long appId; - // 任务自带的参数 + /** + * Params that these jobs carry with when they are created. + */ private String jobParams; - /* ************************** 定时参数 ************************** */ - // 时间表达式类型(CRON/API/FIX_RATE/FIX_DELAY) + /* ************************** Timing param. ************************** */ + /** + * Time expression type. + */ private TimeExpressionType timeExpressionType; - // 时间表达式,CRON/NULL/LONG/LONG + /** + * Time expression. + */ private String timeExpression; - /* ************************** 执行方式 ************************** */ - // 执行类型,单机/广播/MR + /* ************************** Execution type. ************************** */ + /** + * Execution type, {@code standalone}, {@code broadcast} or {@code Map/MapReduce} + */ private ExecuteType executeType; - // 执行器类型,Java/Shell + /** + * Processor type, {@code Java}, {@code Python} or {@code Shell}. + */ private ProcessorType processorType; - // 执行器信息 + /** + * Processor info. + */ private String processorInfo; - /* ************************** 运行时配置 ************************** */ - // 最大同时运行任务数,0 代表不限 + /* ************************** Running instance setting. ************************** */ + /** + * Maximum instance setting num. {@code 0} means there is no restriction. + */ private Integer maxInstanceNum = 0; - // 并发度,同时执行的线程数量 + /** + * Concurrency setting. Number of threads that run simultaneously. + */ private Integer concurrency = 5; - // 任务整体超时时间 + /** + * Max instance running time setting. {@code 0L} means there is no restriction. + */ private Long instanceTimeLimit = 0L; - /* ************************** 重试配置 ************************** */ + /* ************************** Retrial setting. ************************** */ + /** + * Instance retry number setting. + */ private Integer instanceRetryNum = 0; + /** + * Task retry number setting. + */ private Integer taskRetryNum = 0; - /* ************************** 繁忙机器配置 ************************** */ - // 最低CPU核心数量,0代表不限 + /* ************************** Busy Machine setting. ************************** */ + /** + * Minimum CPU required. {@code 0} means there is no restriction. + */ private double minCpuCores = 0; - // 最低内存空间,单位 GB,0代表不限 + /** + * Minimum memory required, in GB. + */ private double minMemorySpace = 0; - // 最低磁盘空间,单位 GB,0代表不限 + /** + * Minimum disk space, in GB. {@code 0} means there is no restriction. + */ private double minDiskSpace = 0; - // 1 正常运行,2 停止(不再调度) + /** + * {@code 1} indicates that the worker node is running well, + * {@code 2} indicates that the worker node has been inactive + * and future tasks will not be assigned to the node. + */ private boolean enable = true; - /* ************************** 集群配置 ************************** */ - // 指定机器运行,空代表不限,非空则只会使用其中的机器运行(多值逗号分割) + /* ************************** PowerJob-worker cluster property ************************** */ + /** + * Designated PowerJob-worker nodes. Blank value indicates that there is + * no limit. Non-blank value means to run the corresponding machine(s) only. + */ private String designatedWorkers; - // 最大机器数量 + /** + * Max count of PowerJob-worker nodes. + */ private Integer maxWorkerCount = 0; - // 报警用户ID列表 + /** + * The id list of the users that need to be notified. + */ private List notifyUserIds; + /** + * Check non-null properties. + */ public void valid() { CommonUtils.requireNonNull(jobName, "jobName can't be empty"); CommonUtils.requireNonNull(appId, "appId can't be empty"); diff --git a/powerjob-server/pom.xml b/powerjob-server/pom.xml index 83885a05..46956b5a 100644 --- a/powerjob-server/pom.xml +++ b/powerjob-server/pom.xml @@ -17,7 +17,7 @@ 2.9.2 2.3.4.RELEASE 3.4.2 - + 8.0.19 19.7.0.0 7.4.1.jre8 @@ -32,7 +32,7 @@ 1.2.68 1.0.1 - + true @@ -136,42 +136,42 @@ test - + net.lingala.zip4j zip4j ${zip4j.version} - + org.eclipse.jgit org.eclipse.jgit ${jgit.version} - + commons-net commons-net ${commons.net.version} - + org.apache.maven.shared maven-invoker ${mvn.invoker.version} - + com.alibaba fastjson ${fastjson.version} - + com.aliyun alibaba-dingtalk-service-sdk @@ -185,7 +185,6 @@ - io.springfox @@ -201,7 +200,7 @@ - + @@ -215,7 +214,7 @@ build-info - repackage + repackage diff --git a/powerjob-server/src/main/java/com/github/kfcfans/powerjob/server/OhMyApplication.java b/powerjob-server/src/main/java/com/github/kfcfans/powerjob/server/OhMyApplication.java index ddb10420..bbcc5c64 100644 --- a/powerjob-server/src/main/java/com/github/kfcfans/powerjob/server/OhMyApplication.java +++ b/powerjob-server/src/main/java/com/github/kfcfans/powerjob/server/OhMyApplication.java @@ -7,7 +7,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.scheduling.annotation.EnableScheduling; /** - * SpringBoot 启动入口 + * SpringBoot entry. * * @author tjq * @since 2020/3/29 @@ -26,16 +26,16 @@ public class OhMyApplication { public static void main(String[] args) { - // 完成前置工作 + // Print tips before starting. pre(); - // 先启动 ActorSystem + // Init ActorSystem OhMyServer.init(); - // 再启动SpringBoot + // Start SpringBoot application. try { SpringApplication.run(OhMyApplication.class, args); - }catch (Throwable t) { + } catch (Throwable t) { log.error(TIPS); throw t; } diff --git a/powerjob-server/src/main/resources/application-daily.properties b/powerjob-server/src/main/resources/application-daily.properties index 18bb67ef..a0b1c299 100644 --- a/powerjob-server/src/main/resources/application-daily.properties +++ b/powerjob-server/src/main/resources/application-daily.properties @@ -1,7 +1,7 @@ oms.env=DAILY logging.config=classpath:logback-dev.xml -####### 外部数据库配置(需要用户更改为自己的数据库配置) ####### +####### Database properties(Configure according to the the environment) ####### spring.datasource.core.driver-class-name=com.mysql.cj.jdbc.Driver spring.datasource.core.jdbc-url=jdbc:mysql://localhost:3306/powerjob-daily?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai spring.datasource.core.username=root @@ -9,11 +9,12 @@ spring.datasource.core.password=No1Bug2Please3! spring.datasource.core.hikari.maximum-pool-size=20 spring.datasource.core.hikari.minimum-idle=5 -####### mongoDB配置,非核心依赖,通过配置 oms.mongodb.enable=false 来关闭 ####### +####### MongoDB properties(Non-core configuration properties) ####### +####### configure oms.mongodb.enable=false to disable mongodb ####### oms.mongodb.enable=true spring.data.mongodb.uri=mongodb+srv://zqq:No1Bug2Please3!@cluster0.wie54.gcp.mongodb.net/powerjob_daily?retryWrites=true&w=majority -####### 邮件配置(不需要邮件报警可以删除以下配置来避免报错) ####### +####### Email properties(Comment out the mail properties if you do not have needs) ####### spring.mail.host=smtp.163.com spring.mail.username=zqq@163.com spring.mail.password=GOFZPNARMVKCGONV @@ -21,18 +22,19 @@ spring.mail.properties.mail.smtp.auth=true spring.mail.properties.mail.smtp.starttls.enable=true spring.mail.properties.mail.smtp.starttls.required=true -####### 钉钉报警配置(不需要钉钉报警可以删除以下配置来避免报错) ####### +####### DingTalk properties(Comment out the DingTalk properties if you do not have needs) ####### oms.alarm.ding.app-key=dingauqwkvxxnqskknfv oms.alarm.ding.app-secret=XWrEPdAZMPgJeFtHuL0LH73LRj-74umF2_0BFcoXMfvnX0pCQvt0rpb1JOJU_HLl oms.alarm.ding.agent-id=847044348 -####### 资源清理配置 ####### +####### Resource cleaning properties ####### oms.instanceinfo.retention=1 oms.container.retention.local=1 oms.container.retention.remote=-1 -####### 缓存配置 ####### +####### Cache properties ####### oms.instance.metadata.cache.size=1024 -####### 精确获取 server 的百分比,0~100,100代表每次 worker 获取 server 都会进行完整的探活流程,不存在脑裂问题,但有性能开销 ####### +####### Threshold in fetching server(0~100). 100 means full detection of server, in which ####### +####### split-brain could be avoided while performance overhead would increase. ####### oms.accurate.select.server.percentage = 50 \ No newline at end of file diff --git a/powerjob-server/src/main/resources/application-pre.properties b/powerjob-server/src/main/resources/application-pre.properties index 496d84ab..f0f27100 100644 --- a/powerjob-server/src/main/resources/application-pre.properties +++ b/powerjob-server/src/main/resources/application-pre.properties @@ -1,7 +1,7 @@ oms.env=PRE logging.config=classpath:logback-product.xml -####### 数据库配置 ####### +####### Database properties(Configure according to the the environment) ####### spring.datasource.core.driver-class-name=com.mysql.cj.jdbc.Driver spring.datasource.core.jdbc-url=jdbc:mysql://remotehost:3306/powerjob-pre?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai spring.datasource.core.username=root @@ -9,11 +9,12 @@ spring.datasource.core.password=No1Bug2Please3! spring.datasource.core.hikari.maximum-pool-size=20 spring.datasource.core.hikari.minimum-idle=5 -####### mongoDB配置,非核心依赖,通过配置 oms.mongodb.enable=false 来关闭 ####### +####### MongoDB properties(Non-core configuration properties) ####### +####### configure oms.mongodb.enable=false to disable mongodb ####### oms.mongodb.enable=true spring.data.mongodb.uri=mongodb://remotehost:27017/powerjob-pre -####### 邮件配置(不需要邮件报警可以删除以下配置来避免报错) ####### +####### Email properties(Comment out the mail properties if you do not have needs) ####### spring.mail.host=smtp.qq.com spring.mail.username=zqq spring.mail.password=qqz @@ -21,18 +22,19 @@ spring.mail.properties.mail.smtp.auth=true spring.mail.properties.mail.smtp.starttls.enable=true spring.mail.properties.mail.smtp.starttls.required=true -####### 钉钉报警配置(不需要钉钉报警可以删除以下配置来避免报错) ####### +####### DingTalk properties(Comment out the DingTalk properties if you do not have needs) ####### oms.alarm.ding.app-key=dingauqwkvxxnqskknfv oms.alarm.ding.app-secret=XWrEPdAZMPgJeFtHuL0LH73LRj-74umF2_0BFcoXMfvnX0pCQvt0rpb1JOJU_HLl oms.alarm.ding.agent-id=847044348 -####### 资源清理配置 ####### +####### Resource cleaning properties ####### oms.instanceinfo.retention=3 oms.container.retention.local=3 oms.container.retention.remote=-1 -####### 缓存配置 ####### +####### Cache properties ####### oms.instance.metadata.cache.size=1024 -####### 精确获取 server 的百分比,0~100,100代表每次 worker 获取 server 都会进行完整的探活流程,不存在脑裂问题,但有性能开销 ####### +####### Threshold in fetching server(0~100). 100 means full detection of server, in which ####### +####### split-brain could be avoided while performance overhead would increase. ####### oms.accurate.select.server.percentage = 50 \ No newline at end of file diff --git a/powerjob-server/src/main/resources/application-product.properties b/powerjob-server/src/main/resources/application-product.properties index 15ee98e4..8b6baad6 100644 --- a/powerjob-server/src/main/resources/application-product.properties +++ b/powerjob-server/src/main/resources/application-product.properties @@ -1,7 +1,7 @@ oms.env=PRODUCT logging.config=classpath:logback-product.xml -####### 数据库配置 ####### +####### Database properties(Configure according to the the environment) ####### spring.datasource.core.driver-class-name=com.mysql.cj.jdbc.Driver spring.datasource.core.jdbc-url=jdbc:mysql://localhost:3306/powerjob-product?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai spring.datasource.core.username=root @@ -9,11 +9,12 @@ spring.datasource.core.password=No1Bug2Please3! spring.datasource.core.hikari.maximum-pool-size=20 spring.datasource.core.hikari.minimum-idle=5 -####### mongoDB配置,非核心依赖,通过配置 oms.mongodb.enable=false 来关闭 ####### +####### MongoDB properties(Non-core configuration properties) ####### +####### configure oms.mongodb.enable=false to disable mongodb ####### oms.mongodb.enable=true spring.data.mongodb.uri=mongodb://localhost:27017/powerjob-product -####### 邮件配置(不需要邮件报警可以删除以下配置来避免报错) ####### +####### Email properties(Comment out the mail properties if you do not have needs) ####### spring.mail.host=smtp.qq.com spring.mail.username=zqq spring.mail.password=qqz @@ -21,18 +22,19 @@ spring.mail.properties.mail.smtp.auth=true spring.mail.properties.mail.smtp.starttls.enable=true spring.mail.properties.mail.smtp.starttls.required=true -####### 钉钉报警配置(不需要钉钉报警可以删除以下配置来避免报错) ####### +####### DingTalk properties(Comment out the DingTalk properties if you do not have needs) ####### oms.alarm.ding.app-key= oms.alarm.ding.app-secret= oms.alarm.ding.agent-id= -####### 资源清理配置 ####### +####### Resource cleaning properties ####### oms.instanceinfo.retention=7 oms.container.retention.local=7 oms.container.retention.remote=-1 -####### 缓存配置 ####### +####### Cache properties ####### oms.instance.metadata.cache.size=2048 -####### 精确获取 server 的百分比,0~100,100代表每次 worker 获取 server 都会进行完整的探活流程,不存在脑裂问题,但有性能开销 ####### +####### Threshold in fetching server(0~100). 100 means full detection of server, in which ####### +####### split-brain could be avoided while performance overhead would increase. ####### oms.accurate.select.server.percentage = 50 \ No newline at end of file diff --git a/powerjob-server/src/main/resources/application.properties b/powerjob-server/src/main/resources/application.properties index d91d0684..002de73c 100644 --- a/powerjob-server/src/main/resources/application.properties +++ b/powerjob-server/src/main/resources/application.properties @@ -1,4 +1,4 @@ -# http 服务端口 +# Http server port server.port=7700 spring.profiles.active=daily @@ -7,14 +7,14 @@ spring.jpa.open-in-view=false spring.data.mongodb.repositories.type=none logging.level.org.mongodb=warn -# 文件上传配置 +# Configuration for uploading files. spring.servlet.multipart.enabled=true spring.servlet.multipart.file-size-threshold=0 spring.servlet.multipart.max-file-size=209715200 spring.servlet.multipart.max-request-size=209715200 -###### PowerJob 自身配置(该配置只允许存在于 application.properties 文件中) ###### -# akka ActorSystem 服务端口 +###### PowerJob self-owned configuration (The following properties should exist in application.properties only). ###### +# Akka ActorSystem port. oms.akka.port=10086 -# 表前缀(默认无表前缀,有需求直接填入表前缀即可,比如 pj_ ) +# Prefix for all tables. Default empty string. Config if you have needs, i.e. pj_ oms.table-prefix= \ No newline at end of file diff --git a/powerjob-server/src/main/resources/logback-dev.xml b/powerjob-server/src/main/resources/logback-dev.xml index ec9b4011..3fdd2c66 100644 --- a/powerjob-server/src/main/resources/logback-dev.xml +++ b/powerjob-server/src/main/resources/logback-dev.xml @@ -1,18 +1,18 @@ - + - - + + - + - + ${CONSOLE_LOG_PATTERN} @@ -20,13 +20,13 @@ - + - + - + diff --git a/powerjob-server/src/main/resources/logback-product.xml b/powerjob-server/src/main/resources/logback-product.xml index 2be6e263..9ccddcd9 100644 --- a/powerjob-server/src/main/resources/logback-product.xml +++ b/powerjob-server/src/main/resources/logback-product.xml @@ -1,20 +1,20 @@ - + - + - + + Log path, pay attention to permission, logs may be unable to generate. + Bug recording: Setting `~/logs`, is unable to create folder in user home directory, + a folder with the name ~ is created in project folder. + --> - - + ${LOG_PATH}/powerjob-server-error.log @@ -31,9 +31,9 @@ DENY - + - + ${LOG_PATH}/powerjob-server-web.log @@ -49,9 +49,9 @@ - + - + ${LOG_PATH}/powerjob-server-application.log @@ -64,7 +64,7 @@ true - + diff --git a/powerjob-worker-agent/pom.xml b/powerjob-worker-agent/pom.xml index 94ea9386..4761e8b2 100644 --- a/powerjob-worker-agent/pom.xml +++ b/powerjob-worker-agent/pom.xml @@ -50,7 +50,6 @@ - @@ -63,7 +62,7 @@ - repackage + repackage diff --git a/powerjob-worker-samples/src/main/resources/application.properties b/powerjob-worker-samples/src/main/resources/application.properties index 17bfa59f..79e356e3 100644 --- a/powerjob-worker-samples/src/main/resources/application.properties +++ b/powerjob-worker-samples/src/main/resources/application.properties @@ -1,15 +1,13 @@ server.port=8081 - spring.jpa.open-in-view=false - -########### powerjob-worker 配置(老配置 powerjob.xxx 即将废弃,请使用 powerjob.worker.xxx) ########### -# akka 工作端口,可选,默认 27777 +########### PowerJob-worker properties. ########### +# Akka port, default is 27777 powerjob.worker.akka-port=27777 -# 接入应用名称,用于分组隔离,推荐填写 本 Java 项目名称 +# Application name, used for grouping applications. Recommend to set the same value as project name. powerjob.worker.app-name=powerjob-agent-test -# 调度服务器地址,IP:Port 或 域名,多值逗号分隔 +# Address of PowerJob-server node(s). Ip:port or domain. Multiple addresses should be separated with comma. powerjob.worker.server-address=127.0.0.1:7700,127.0.0.1:7701 -# 持久化方式,可选,默认 disk +# Store strategy of H2 database. disk or memory. Default value is disk. powerjob.worker.store-strategy=disk -# 返回值最大长度,默认 8096 +# Max length of result. Results that are longer than the value will be truncated. powerjob.worker.max-result-length=4096 \ No newline at end of file diff --git a/powerjob-worker-spring-boot-starter/src/main/java/com/github/kfcfans/powerjob/worker/autoconfigure/PowerJobAutoConfiguration.java b/powerjob-worker-spring-boot-starter/src/main/java/com/github/kfcfans/powerjob/worker/autoconfigure/PowerJobAutoConfiguration.java index f562d391..577d7db6 100644 --- a/powerjob-worker-spring-boot-starter/src/main/java/com/github/kfcfans/powerjob/worker/autoconfigure/PowerJobAutoConfiguration.java +++ b/powerjob-worker-spring-boot-starter/src/main/java/com/github/kfcfans/powerjob/worker/autoconfigure/PowerJobAutoConfiguration.java @@ -16,7 +16,7 @@ import java.util.Arrays; import java.util.List; /** - * PowerJob 自动装配 + * Auto configuration class for PowerJob-worker. * * @author songyinyin * @since 2020/7/26 16:37 @@ -32,30 +32,46 @@ public class PowerJobAutoConfiguration { PowerJobProperties.Worker worker = properties.getWorker(); - // 服务器HTTP地址(端口号为 server.port,而不是 ActorSystem port),请勿添加任何前缀(http://) + /* + * Address of PowerJob-server node(s). Do not mistake for ActorSystem port. Do not add + * any prefix, i.e. http://. + */ CommonUtils.requireNonNull(worker.getServerAddress(), "serverAddress can't be empty!"); List serverAddress = Arrays.asList(worker.getServerAddress().split(",")); - // 1. 创建配置文件 + /* + * Create OhMyConfig object for setting properties. + */ OhMyConfig config = new OhMyConfig(); - - // 端口配置,支持随机端口 + /* + * Configuration of worker port. Random port is enabled when port is set with non-positive number. + */ int port = worker.getAkkaPort(); if (port <= 0) { port = NetUtils.getRandomPort(); } config.setPort(port); - - // appName,需要提前在控制台注册,否则启动报错 + /* + * appName, name of the application. Applications should be registered in advance to prevent + * error. This property should be the same with what you entered for appName when getting + * registered. + */ config.setAppName(worker.getAppName()); config.setServerAddress(serverAddress); - // 如果没有大型 Map/MapReduce 的需求,建议使用内存来加速计算 - // 有大型 Map/MapReduce 需求,可能产生大量子任务(Task)的场景,请使用 DISK,否则妥妥的 OutOfMemory + /* + * For non-Map/MapReduce tasks, {@code memory} is recommended for speeding up calculation. + * Map/MapReduce tasks may produce batches of subtasks, which could lead to OutOfMemory + * exception or error, {@code disk} should be applied. + */ config.setStoreStrategy(worker.getStoreStrategy()); - // 启动测试模式,true情况下,不再尝试连接 server 并验证appName + /* + * When enabledTestMode is set as true, PowerJob-worker no longer connects to PowerJob-server + * or validate appName. + */ config.setEnableTestMode(worker.isEnableTestMode()); - - // 2. 创建 Worker 对象,设置配置文件 + /* + * Create OhMyWorker object and set properties. + */ OhMyWorker ohMyWorker = new OhMyWorker(); ohMyWorker.setConfig(config); return ohMyWorker; diff --git a/powerjob-worker-spring-boot-starter/src/main/java/com/github/kfcfans/powerjob/worker/autoconfigure/PowerJobProperties.java b/powerjob-worker-spring-boot-starter/src/main/java/com/github/kfcfans/powerjob/worker/autoconfigure/PowerJobProperties.java index 480e9e8d..e8dd2d07 100644 --- a/powerjob-worker-spring-boot-starter/src/main/java/com/github/kfcfans/powerjob/worker/autoconfigure/PowerJobProperties.java +++ b/powerjob-worker-spring-boot-starter/src/main/java/com/github/kfcfans/powerjob/worker/autoconfigure/PowerJobProperties.java @@ -9,7 +9,7 @@ import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.boot.context.properties.DeprecatedConfigurationProperty; /** - * PowerJob 配置项 + * PowerJob properties configuration class. * * @author songyinyin * @since 2020/7/26 16:37 @@ -90,37 +90,49 @@ public class PowerJobProperties { } - /** - * 客户端 配置项 + * Powerjob worker configuration properties. */ @Setter @Getter public static class Worker { /** - * 应用名称,需要提前在控制台注册,否则启动报错 + * Name of application, String type. Total length of this property should be no more than 255 + * characters. This is one of the required properties when registering a new application. This + * property should be assigned with the same value as what you entered for the appName. */ private String appName; /** - * 启动 akka 端口 + * Akka port of Powerjob-worker, optional value. Default value of this property is 27777. + * If multiple PowerJob-worker nodes were deployed, different, unique ports should be assigned. */ private int akkaPort = RemoteConstant.DEFAULT_WORKER_PORT; /** - * 调度服务器地址,ip:port 或 域名,多个用英文逗号分隔 + * Address(es) of Powerjob-server node(s). Ip:port or domain. + * Example of single Powerjob-server node: + *

+ * 127.0.0.1:7700 + *

+ * Example of Powerjob-server cluster: + *

+ * 192.168.0.10:7700,192.168.0.11:7700,192.168.0.12:7700 + *

*/ private String serverAddress; /** - * 本地持久化方式,默认使用磁盘 + * Local store strategy for H2 database. {@code disk} or {@code memory}. */ private StoreStrategy storeStrategy = StoreStrategy.DISK; /** - * 最大返回值长度,超过会被截断 - * {@link ProcessResult}#msg 的最大长度 + * Max length of response result. Result that is longer than the value will be truncated. + * {@link ProcessResult} max length for #msg */ private int maxResultLength = 8096; /** - * 启动测试模式,true情况下,不再尝试连接 server 并验证appName。 - * true -> 用于本地写单元测试调试; false -> 默认值,标准模式 + * If test mode is set as true, Powerjob-worker no longer connects to the server or validates appName. + * Test mode is used for conditions that your worker does not need to run the codes, i.e. when you + * write junit tests in local environment. {@code true} means test mode is enabled. {@code false} means + * normal mode is applied. */ private boolean enableTestMode = false; } diff --git a/powerjob-worker-spring-boot-starter/src/main/resources/META-INF/spring-configuration-metadata.json b/powerjob-worker-spring-boot-starter/src/main/resources/META-INF/spring-configuration-metadata.json index a67473e2..01a0eb3d 100644 --- a/powerjob-worker-spring-boot-starter/src/main/resources/META-INF/spring-configuration-metadata.json +++ b/powerjob-worker-spring-boot-starter/src/main/resources/META-INF/spring-configuration-metadata.json @@ -16,39 +16,39 @@ { "name": "powerjob.worker.akka-port", "type": "java.lang.Integer", - "description": "启动 akka 端口", + "description": "Akka port of PowerJob-worker", "sourceType": "com.github.kfcfans.powerjob.worker.autoconfigure.PowerJobProperties$Worker" }, { "name": "powerjob.worker.app-name", "type": "java.lang.String", - "description": "应用名称,需要提前在控制台注册,否则启动报错", + "description": "Name of application. Register in PowerJob-console to prevent error.", "sourceType": "com.github.kfcfans.powerjob.worker.autoconfigure.PowerJobProperties$Worker" }, { "name": "powerjob.worker.enable-test-mode", "type": "java.lang.Boolean", - "description": "启动测试模式,true情况下,不再尝试连接 server 并验证appName。 true -> 用于本地写单元测试调试; false -> 默认值,标准模式", + "description": "Whether to enable test mode. In test mode, worker will not connect to server.", "sourceType": "com.github.kfcfans.powerjob.worker.autoconfigure.PowerJobProperties$Worker", "defaultValue": false }, { "name": "powerjob.worker.max-result-length", "type": "java.lang.Integer", - "description": "最大返回值长度,超过会被截断 {@link ProcessResult}#msg 的最大长度", + "description": "Max length for {@link ProcessResult}#msg, result longer than this property will be truncated.", "sourceType": "com.github.kfcfans.powerjob.worker.autoconfigure.PowerJobProperties$Worker", "defaultValue": 8096 }, { "name": "powerjob.worker.server-address", "type": "java.lang.String", - "description": "调度服务器地址,ip:port 或 域名,多个用英文逗号分隔", + "description": "PowerJob-server node(s) address. Ip:port or domain, multiple addresses should be separated with comma", "sourceType": "com.github.kfcfans.powerjob.worker.autoconfigure.PowerJobProperties$Worker" }, { "name": "powerjob.worker.store-strategy", "type": "com.github.kfcfans.powerjob.worker.common.constants.StoreStrategy", - "description": "本地持久化方式,默认使用磁盘", + "description": "Local store strategy, disk or memory", "sourceType": "com.github.kfcfans.powerjob.worker.autoconfigure.PowerJobProperties$Worker" } ], diff --git a/powerjob-worker-spring-boot-starter/src/test/java/com/github/kfcfans/powerjob/worker/autoconfigure/PowerJobAutoConfigurationTest.java b/powerjob-worker-spring-boot-starter/src/test/java/com/github/kfcfans/powerjob/worker/autoconfigure/PowerJobAutoConfigurationTest.java index dd90d395..62dfa4a2 100644 --- a/powerjob-worker-spring-boot-starter/src/test/java/com/github/kfcfans/powerjob/worker/autoconfigure/PowerJobAutoConfigurationTest.java +++ b/powerjob-worker-spring-boot-starter/src/test/java/com/github/kfcfans/powerjob/worker/autoconfigure/PowerJobAutoConfigurationTest.java @@ -1,7 +1,7 @@ package com.github.kfcfans.powerjob.worker.autoconfigure; import com.github.kfcfans.powerjob.worker.OhMyWorker; -import org.junit.Assert; +import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; @@ -16,7 +16,7 @@ class PowerJobAutoConfigurationTest { void testAutoConfiguration() { ConfigurableApplicationContext run = SpringApplication.run(PowerJobAutoConfigurationTest.class); OhMyWorker worker = run.getBean(OhMyWorker.class); - Assert.assertNotNull(worker); + Assertions.assertNotNull(worker); } } diff --git a/powerjob-worker-spring-boot-starter/src/test/resources/application.properties b/powerjob-worker-spring-boot-starter/src/test/resources/application.properties index fbcb42fa..46f6cdd3 100644 --- a/powerjob-worker-spring-boot-starter/src/test/resources/application.properties +++ b/powerjob-worker-spring-boot-starter/src/test/resources/application.properties @@ -1,2 +1 @@ - powerjob.enable-test-mode=true \ No newline at end of file