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** |
| 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** |

View File

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

View File

@ -16,30 +16,60 @@ 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;
// 秒级任务专用
/**
*
*/
private List<SubInstanceDetail> subInstanceDetails;
// 重试次数
/**
*
*/
private Long runningTimes;
// 扩展字段中间件升级不易最好不要再改 common 包了...否则 server worker 版本不兼容
/**
* Extend
*/
private String extra;
// 秒级任务的 extra -> List<SubInstanceDetail>

View File

@ -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<Node> nodes;
/**
* Edges of DAG diagram.
*/
private List<Edge> 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

View File

@ -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<SystemMetrics> {
// 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<SystemMetrics>
}
/**
* 该机器是否可用
* @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<SystemMetrics>
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;
}

View File

@ -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 {
// 任务IDjobIdnull -> 插入否则为更新
/**
* 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;
// 任务所属的应用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;
// 任务自带的参数
/**
* 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;
// 最低内存空间单位 GB0代表不限
/**
* Minimum memory required, in GB.
*/
private double minMemorySpace = 0;
// 最低磁盘空间单位 GB0代表不限
/**
* 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<Long> notifyUserIds;
/**
* Check non-null properties.
*/
public void valid() {
CommonUtils.requireNonNull(jobName, "jobName can't be empty");
CommonUtils.requireNonNull(appId, "appId can't be empty");