docs: Add translations for models in PowerJob-common.

This commit is contained in:
jjn 2021-01-08 22:20:35 +08:00
parent d5ab77ddbd
commit b1b8e1de95
6 changed files with 189 additions and 65 deletions

View File

@ -58,7 +58,7 @@ Application password: 123
| Distributed strategy | Unsupported | Static sharding | MapReduce dynamic sharding | **MapReduce dynamic sharding** | | Distributed strategy | Unsupported | Static sharding | MapReduce dynamic sharding | **MapReduce dynamic sharding** |
| Online task management | Unsupported | Supported | Supported | **Supported** | | Online task management | Unsupported | Supported | Supported | **Supported** |
| Online logging | Unsupported | Supported | Unsupported | **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.** | | 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** | | 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** | | workflow | Unsupported | Unsupported | Supported | **Supported** |

View File

@ -3,7 +3,7 @@ package com.github.kfcfans.powerjob.common.model;
import lombok.Data; import lombok.Data;
/** /**
* The class for Git Repository. * The class for Git Repository info.
* *
* @author tjq * @author tjq
* @since 2020/5/17 * @since 2020/5/17

View File

@ -16,30 +16,60 @@ import java.util.List;
@NoArgsConstructor @NoArgsConstructor
public class InstanceDetail implements OmsSerializable { public class InstanceDetail implements OmsSerializable {
// 任务预计执行时间 /**
* Expected trigger time.
*/
private Long expectedTriggerTime; private Long expectedTriggerTime;
// 任务整体开始时间 /**
* Actual trigger time of an instance.
*/
private Long actualTriggerTime; private Long actualTriggerTime;
// 任务整体结束时间可能不存在 // 任务整体结束时间可能不存在
/**
* Finish time of an instance, which may be null.
*/
private Long finishedTime; private Long finishedTime;
// 任务状态 /**
* Status of the task instance.
*/
private Integer status; private Integer status;
// 任务执行结果可能不存在 // 任务执行结果可能不存在
/**
* Execution result, which may be null.
*/
private String result; private String result;
// TaskTracker地址 // TaskTracker地址
/**
* Task tracker address.
*/
private String taskTrackerAddress; private String taskTrackerAddress;
// 启动参数 // 启动参数
/**
* Param string that is passed to an instance when it is initialized.
*/
private String instanceParams; private String instanceParams;
// MR或BD任务专用 // MR或BD任务专用
/**
* Task detail, used by MapReduce or Broadcast tasks.
*/
private TaskDetail taskDetail; private TaskDetail taskDetail;
// 秒级任务专用 // 秒级任务专用
/**
*
*/
private List<SubInstanceDetail> subInstanceDetails; private List<SubInstanceDetail> subInstanceDetails;
// 重试次数 // 重试次数
/**
*
*/
private Long runningTimes; private Long runningTimes;
// 扩展字段中间件升级不易最好不要再改 common 包了...否则 server worker 版本不兼容 // 扩展字段中间件升级不易最好不要再改 common 包了...否则 server worker 版本不兼容
/**
* Extend
*/
private String extra; private String extra;
// 秒级任务的 extra -> List<SubInstanceDetail> // 秒级任务的 extra -> List<SubInstanceDetail>

View File

@ -13,8 +13,7 @@ import java.io.Serializable;
import java.util.List; import java.util.List;
/** /**
* Point & Edge DAG 表示法 * Points & edges for DAG, making it easier to describe or transfer.
* + 线易于表达和传播
* *
* @author tjq * @author tjq
* @since 2020/5/26 * @since 2020/5/26
@ -23,11 +22,18 @@ import java.util.List;
@NoArgsConstructor @NoArgsConstructor
public class PEWorkflowDAG implements Serializable { public class PEWorkflowDAG implements Serializable {
// DAG 点线表示法 /**
* Nodes of DAG diagram.
*/
private List<Node> nodes; private List<Node> nodes;
/**
* Edges of DAG diagram.
*/
private List<Edge> edges; private List<Edge> edges;
// /**
* Point.
*/
@Data @Data
@NoArgsConstructor @NoArgsConstructor
@AllArgsConstructor @AllArgsConstructor
@ -35,7 +41,9 @@ public class PEWorkflowDAG implements Serializable {
private Long jobId; private Long jobId;
private String jobName; private String jobName;
// 运行时参数图定义不需要 /**
* Instance running param, which is not required by DAG.
*/
@JsonSerialize(using= ToStringSerializer.class) @JsonSerialize(using= ToStringSerializer.class)
private Long instanceId; private Long instanceId;
private Integer status; private Integer status;
@ -47,7 +55,9 @@ public class PEWorkflowDAG implements Serializable {
} }
} }
// jobId -> jobId /**
* Edge formed by two job ids.
*/
@Data @Data
@NoArgsConstructor @NoArgsConstructor
@AllArgsConstructor @AllArgsConstructor

View File

@ -4,7 +4,7 @@ import com.github.kfcfans.powerjob.common.OmsSerializable;
import lombok.Data; import lombok.Data;
/** /**
* 系统指标 * Class for system metrics .
* *
* @author tjq * @author tjq
* @since 2020/3/25 * @since 2020/3/25
@ -12,35 +12,63 @@ import lombok.Data;
@Data @Data
public class SystemMetrics implements OmsSerializable, Comparable<SystemMetrics> { public class SystemMetrics implements OmsSerializable, Comparable<SystemMetrics> {
// CPU核心数量 /**
* CPU processor num.
*/
private int cpuProcessors; private int cpuProcessors;
// CPU负载负载 使用率 是两个完全不同的概念Java 无法获取 CPU 使用率只能获取负载 /**
* Percent of CPU load.
*/
private double cpuLoad; private double cpuLoad;
// 内存单位 GB /**
* Memory that is used by JVM, in GB.
*/
private double jvmUsedMemory; private double jvmUsedMemory;
/**
* Max memory that JVM can use, in GB.
*/
private double jvmMaxMemory; 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; private double jvmMemoryUsage;
// 磁盘单位 GB /**
* Total used disk space, in GB.
*/
private double diskUsed; private double diskUsed;
/**
* Total disk space, in GB.
*/
private double diskTotal; private double diskTotal;
// 磁盘占用0.X非百分比 /**
* Used disk ratio.
*/
private double diskUsage; private double diskUsage;
// 缓存分数 /**
* Score of cache.
*/
private int score; private int score;
/**
* Override compareTo.
*
* @param that the metrics that is to be compared with current.
* @return {@code int}
*/
@Override @Override
public int compareTo(SystemMetrics that) { public int compareTo(SystemMetrics that) {
// 降序排列 // Sort by metrics in descending order.
return that.calculateScore() - this.calculateScore(); return that.calculateScore() - this.calculateScore();
} }
/** /**
* 计算得分情况内存 & CPU (磁盘不参与计算) * Calculate score, based on CPU and memory info.
* @return 得分情况 *
* @return score
*/ */
public int calculateScore() { public int calculateScore() {
@ -48,11 +76,11 @@ public class SystemMetrics implements OmsSerializable, Comparable<SystemMetrics>
return score; return score;
} }
// 对于 TaskTracker 来说内存是任务顺利完成的关键因此内存 2 块钱 1GB // Memory is vital to TaskTracker, so we set the multiplier factor as 2.
double memScore = (jvmMaxMemory - jvmUsedMemory) * 2; double memScore = (jvmMaxMemory - jvmUsedMemory) * 2;
// CPU 剩余负载1 块钱 1 // Calculate the remaining load of CPU. Multiplier is set as 1.
double cpuScore = cpuProcessors - cpuLoad; double cpuScore = cpuProcessors - cpuLoad;
// Indian Windows 无法获取 CpuLoad -1固定为 1 // Windows can not fetch CPU load, set cpuScore as 1.
if (cpuScore > cpuProcessors) { if (cpuScore > cpuProcessors) {
cpuScore = 1; cpuScore = 1;
} }
@ -62,11 +90,12 @@ public class SystemMetrics implements OmsSerializable, Comparable<SystemMetrics>
} }
/** /**
* 该机器是否可用 * Judge if the machine is available.
* @param minCPUCores 判断标准之最低可用CPU核心数量 *
* @param minCPUCores Minimum available CPU cores.
* @param minMemorySpace 判断标准之最低可用内存 * @param minMemorySpace 判断标准之最低可用内存
* @param minDiskSpace 判断标准之最低可用磁盘空间 * @param minDiskSpace Minimum disk space 判断标准之最低可用磁盘空间
* @return 是否可用 * @return {@code boolean} whether the machine is available.
*/ */
public boolean available(double minCPUCores, double minMemorySpace, double minDiskSpace) { public boolean available(double minCPUCores, double minMemorySpace, double minDiskSpace) {
@ -77,7 +106,8 @@ public class SystemMetrics implements OmsSerializable, Comparable<SystemMetrics>
return false; 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) { if (cpuLoad <= 0 || minCPUCores <= 0) {
return true; return true;
} }

View File

@ -9,7 +9,7 @@ import lombok.Data;
import java.util.List; import java.util.List;
/** /**
* 创建/修改 JobInfo 请求 * Save or modify {@link com.github.kfcfans.powerjob.common.response.JobInfoDTO}
* *
* @author tjq * @author tjq
* @since 2020/3/30 * @since 2020/3/30
@ -17,68 +17,122 @@ import java.util.List;
@Data @Data
public class SaveJobInfoRequest { public class SaveJobInfoRequest {
// 任务IDjobIdnull -> 插入否则为更新 /**
* id of the job. set null to save or non-null to update the job.
*/
private Long id; private Long id;
/* ************************** 任务基本信息 ************************** */ /* ************************** Base info of related job. ************************** */
// 任务名称
/**
* Name of the job.
*/
private String jobName; private String jobName;
// 任务描述 /**
* Description of the job.
*/
private String jobDescription; private String jobDescription;
// 任务所属的应用IDClient无需填写该参数自动填充 /**
* 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; private Long appId;
// 任务自带的参数 /**
* Params that these jobs carry with when they are created.
*/
private String jobParams; private String jobParams;
/* ************************** 定时参数 ************************** */ /* ************************** Timing param. ************************** */
// 时间表达式类型CRON/API/FIX_RATE/FIX_DELAY /**
* Time expression type.
*/
private TimeExpressionType timeExpressionType; private TimeExpressionType timeExpressionType;
// 时间表达式CRON/NULL/LONG/LONG /**
* Time expression.
*/
private String timeExpression; private String timeExpression;
/* ************************** 执行方式 ************************** */ /* ************************** Execution type. ************************** */
// 执行类型单机/广播/MR /**
* Execution type, {@code standalone}, {@code broadcast} or {@code Map/MapReduce}
*/
private ExecuteType executeType; private ExecuteType executeType;
// 执行器类型Java/Shell /**
* Processor type, {@code Java}, {@code Python} or {@code Shell}.
*/
private ProcessorType processorType; private ProcessorType processorType;
// 执行器信息 /**
* Processor info.
*/
private String processorInfo; private String processorInfo;
/* ************************** 运行时配置 ************************** */ /* ************************** Running instance setting. ************************** */
// 最大同时运行任务数0 代表不限 /**
* Maximum instance setting num. {@code 0} means there is no restriction.
*/
private Integer maxInstanceNum = 0; private Integer maxInstanceNum = 0;
// 并发度同时执行的线程数量 /**
* Concurrency setting. Number of threads that run simultaneously.
*/
private Integer concurrency = 5; private Integer concurrency = 5;
// 任务整体超时时间 /**
* Max instance running time setting. {@code 0L} means there is no restriction.
*/
private Long instanceTimeLimit = 0L; private Long instanceTimeLimit = 0L;
/* ************************** 重试配置 ************************** */ /* ************************** Retrial setting. ************************** */
/**
* Instance retry number setting.
*/
private Integer instanceRetryNum = 0; private Integer instanceRetryNum = 0;
/**
* Task retry number setting.
*/
private Integer taskRetryNum = 0; private Integer taskRetryNum = 0;
/* ************************** 繁忙机器配置 ************************** */ /* ************************** Busy Machine setting. ************************** */
// 最低CPU核心数量0代表不限 /**
* Minimum CPU required. {@code 0} means there is no restriction.
*/
private double minCpuCores = 0; private double minCpuCores = 0;
// 最低内存空间单位 GB0代表不限 /**
* Minimum memory required, in GB.
*/
private double minMemorySpace = 0; private double minMemorySpace = 0;
// 最低磁盘空间单位 GB0代表不限 /**
* Minimum disk space, in GB. {@code 0} means there is no restriction.
*/
private double minDiskSpace = 0; 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; 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; private String designatedWorkers;
// 最大机器数量 /**
* Max count of PowerJob-worker nodes.
*/
private Integer maxWorkerCount = 0; private Integer maxWorkerCount = 0;
// 报警用户ID列表 /**
* The id list of the users that need to be notified.
*/
private List<Long> notifyUserIds; private List<Long> notifyUserIds;
/**
* Check non-null properties.
*/
public void valid() { public void valid() {
CommonUtils.requireNonNull(jobName, "jobName can't be empty"); CommonUtils.requireNonNull(jobName, "jobName can't be empty");
CommonUtils.requireNonNull(appId, "appId can't be empty"); CommonUtils.requireNonNull(appId, "appId can't be empty");